On 30. Aug, 2009, at 2:01, Alex H 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??
Well, you certainly don't provide enough information for anybody to help you here... However, some general remarks:
First: .h files are not "linked", they are "included". Fundamentally different concepts. Second: In which file are Exp::Exp(double) and Exp::execute() defined (NOT declared)?
It looks to me as if you're not linking against the file where those functions are defined. Now, this can be an object file or a library. From what you describe above I can't tell.
Michael _______________________________________________ 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
