[CMake] Linking fails on small program

alexandre at crans.org alexandre at crans.org
Sat Sep 19 19:16:48 EDT 2009


Hello,

I have split a small test program into three files (plus header files). 
The CMakeLists.txt is the following :

cmake_minimum_required (VERSION 2.6)
project (Zou)
add_library(Matrix matrix.cpp)
add_library(Pose pose.cpp)
add_executable (Zou main.cpp)
link_libraries(Zou Pose Matrix)

When running (cmake and then) make, I get the following error :

[...]
Linking CXX executable Zou
CMakeFiles/Zou.dir/main.cpp.o: In function `main':
main.cpp:(.text+0xb7): undefined reference to `Triangle::Triangle()'
[...]

Though, Triangle::Triangle() is adequately coded in pose.cpp. What does 
go wrong ?

Thank you,
Alexandre


More information about the CMake mailing list