On Sat, Aug 29, 2009 at 8:01 PM, Alex H <[email protected]> wrote:
> I have a test.cpp file and the test file needs to be linked with another > .h file... they are all in the same directory, however when I run the > Makefile that is generated by CMake, it shows this error: > CMakeFiles/bcoin.dir/test.cpp.o: In function `main': > test.cpp:(.text+0xd7): undefined reference to `Exp::Exp(double)' > test.cpp:(.text+0x114): undefined reference to `Exp::execute()' > > I think I need to add some more command to my CMakeLists.txt, how can I do > this?? > If the Exp class is contained in a library, use target_link_libraries(<test_target_name> <library_name_with_Exp_in_it>) If the Exp class is not contained in a library, add it to the list of source files, use add_executable(<test_target_name> test.cpp <Exp_cpp_filename>) -- Philip Lowman
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
