<div class="gmail_quote">On Sat, Aug 29, 2009 at 8:01 PM, Alex H <span dir="ltr">&lt;<a href="mailto:aditya15417@hotmail.com">aditya15417@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>
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:<div><br></div><div>
<div>CMakeFiles/bcoin.dir/test.cpp.o: In function `main&#39;:</div><div>test.cpp:(.text+0xd7): undefined reference to `Exp::Exp(double)&#39;</div><div>test.cpp:(.text+0x114): undefined reference to `Exp::execute()&#39;</div>
<div><br></div><div>I think I need to add some more command to my CMakeLists.txt, how can I do this??</div></div></div></blockquote><div><br><div><br>
If the Exp class is contained in a library, use
target_link_libraries(&lt;test_target_name&gt;
&lt;library_name_with_Exp_in_it&gt;)<br>
If the Exp class is not contained in a library, add it to the list of
source files, use add_executable(&lt;test_target_name&gt; test.cpp
&lt;Exp_cpp_filename&gt;)<br>
</div> <br clear="all"></div></div><br>-- <br>Philip Lowman<br>