[CMake] Problem linking to shared library (inside project) after upgrade to cmake 2.6

Philip Lowman philip at yhbt.com
Sat Jul 12 08:34:25 EDT 2008


On Sat, Jul 12, 2008 at 7:21 AM, Yogesh Marwaha <yogeshm.007 at gmail.com>
wrote:

> Hello, can someone figure out what I'm doing wrong.
> Here is the output I get when I attempt to compile: -
> =================================
> yogesh at linux-sm3q:~/gravity/New> make
> Scanning dependencies of target GravityCore
> [ 91%] Built target GravityCore
> Scanning dependencies of target Gravity
> Linking CXX executable Gravity
> CMakeFiles/Gravity.dir/main.o: In function `main':
> /home/yogesh/gravity/app/main.cpp:10: undefined reference to
> `GApplication::GApplication()'
> /home/yogesh/gravity/app/main.cpp:12: undefined reference to
> `Gravity::self()'
> /home/yogesh/gravity/app/main.cpp:12: undefined reference to
> `Gravity::gUIInterfaceManager() const'
> /home/yogesh/gravity/app/main.cpp:13: undefined reference to
> `GApplication::~GApplication()'
> collect2: ld returned 1 exit status
> make[2]: *** [app/Gravity] Error 1
> make[1]: *** [app/CMakeFiles/Gravity.dir/all] Error 2
> make: *** [all] Error 2
> =================================


I would do a "make VERBOSE=1" and verify that CMake is linking your
executable against what you think it should be linking against.

If that was not the problem, I'd have a second look at your library
implementations and double check that you're compiling and linking what you
think you're compiling and linking.  You can use "nm" or some other tool to
inspect the generated shared libraries and ensure that the proper symbols
are defined (or not defined).

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080712/c25984c4/attachment.htm>


More information about the CMake mailing list