[CMake] CMake Tutorial and Error: undefined symbols

David Morris dvmorris at gmail.com
Sun Jan 28 12:37:02 EST 2007


On 1/28/07, Eric Noulard <eric.noulard at gmail.com> wrote:
>
> 2007/1/27, David Morris <dvmorris at gmail.com>:
> > I'm new to cmake, and I have been trying to find a good comprehensive
> > tutorial to get myself started, but have had no luck. Does anyone know a
> > good one besides the cmake.org site and the linuxjournal one?
>
> No but the Wiki http://www.cmake.org/Wiki/CMake
> is a good start.
>
> Moreover I advise you to read (even fast read) the
> documentation "man cmake" or "http://www.cmake.org/HTML/Documentation.html
> ".
>
> >From my experience with different collegue/friend
> "standalone" startup time  with CMake is from 1 to 3 days
> where you find yourself "lost".
>
> After that period you keep getting things work as you want
> faster and faster.
>
> >
> > I will try to describe one problem i'm having, but I'm not really sure
> where
> > to begin. I'm trying to compile a C++ project and I get this error:
> >
> > /usr/bin/ld: Undefined symbols:
> > _glBegin
> >  _glBindTexture
> > _glColor3d
> > _glColor3f
> > _glCullFace
> > ...
> > ...
>
> Seems you need to link with OpenGL.
> Try add the following to
>
> FIND_PACKAGE(OpenGL)
> IF (OPENGL_FOUND)
>   MESSAGE(STATUS "Looking for OpenGL - found : ${OPENGL_gl_LIBRARY}")
>   GET_FILENAME_COMPONENT(GLPATH ${OPENGL_gl_LIBRARY} PATH)
>   LINK_DIRECTORIES(${GLPATH})
> ELSE (OPENGL_FOUND)
>   MESSAGE(STATUS "Looking for OpenGL - not found")
> ENDIF (OPENGL_FOUND)
>
>
> >
> > SET(Libraries fltk_images fltk_gl fltk arcball vecmat)
> >
> > SET(CurrentExe "TopMod")
> > FILE(GLOB SRC *.cc)
> > ADD_EXECUTABLE(${CurrentExe} ${SRC})
> > TARGET_LINK_LIBRARIES(${CurrentExe} ${Libraries})
>
> ADD GL library
>
> TARGET_LINK_LIBRARIES(${CurrentExe} ${OPENGL_gl_LIBRARY})
>
> --
> Erk
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



That code seemed to work for OpenGL,  thanks.

I am still getting some unresolved symbols, but none that have anything to
do with OpenGL:

/usr/bin/ld: Undefined symbols:
_ClipRect
_GetPort
_GetWindowPort
_SetPort
_SetRect
_GetWindowPortBounds
_AECountItems
_AECreateDesc
_AEDisposeDesc
_AEGetNthPtr
_AEGetParamDesc

searching for these terms on google always show me something that is Apple
specific, and I found one old mailing list post about how CMake thinks I'm
not compiling on a OS X anymore, and that I need to trick it into changing
the compiler. I checked out my CMakeCache.txt file in my project directory,
and I found these lines:

//C compiler.
CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++

I'm not sure if the CXX compiler is correct, or if it should be g++. I tried
changing it there but it didn't go anything. Any ideas?
thanks for the help,
dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070128/16f06c54/attachment.html


More information about the CMake mailing list