[CMake] include file

Michael Wild themiwi at gmail.com
Sun Aug 30 04:52:55 EDT 2009


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


More information about the CMake mailing list