<div dir="ltr"><div><div><div><div>Hi Alessio,<br></div>are you building <i>OtherLibrary</i> as a library itself (be it dynamic or static)?<br><br></div>If you want to use it as a library you shoud build it first (i.e., you should write its own CMakeLists.txt, configure and generate the project, and build it), and then you should be able to link against and use it from other projects.<br>
<br></div>HTH,<br></div>JON HAITZ<br><div><div><div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 8 January 2014 22:48, Alessio Mazzarini <span dir="ltr"><<a href="mailto:alessiomazzarini89@gmail.com" target="_blank">alessiomazzarini89@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone. I have a problem to link together some libraries with my ITK project.<br>
I made my own filter "MyOwnFilter.h" and its implementation "MyOwnFilter.hxx". In this filter i want to use some methods and members defined in another library called "OtherLibrary.h", which are implemented in "OtherLibrary.cpp".<br>
In the header of MyOwnFilter i write: #include "OtherLibrary.h"<br>
All of these files are in the same directory.<br>
When i run Cmake no errors appear, but when i try to "make" the file in the directory the terminal gives me this error:<br>
<br>
.....$ make<br>
[100%] Building CXX object CMakeFiles/MyProject.dir/main.<u></u>cxx.o<br>
Linking CXX executable MyProject<br>
/usr/bin/ld: cannot find -lOtherLibrary<br>
collect2: ld returned 1 exit status<br>
make[2]: *** [MyProject] Error 1<br>
make[1]: *** [CMakeFiles/MyProject.dir/all] Error 2<br>
make: *** [all] Error 2<br>
<br>
<br>
<br>
<br>
My CmakeLists File is the following:<br>
<br>
PROJECT (MyProject)<br>
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)<br>
<br>
FIND_PACKAGE (ITK REQUIRED)<br>
INCLUDE (${ITK_USE_FILE})<br>
<br>
ADD_EXECUTABLE (MyProject main.cxx)<br>
<br>
TARGET_LINK_LIBRARIES(<u></u>MyOwnFilter OtherLibrary ${ITK_LIBRARIES})<br>
<br>
<br>
<br>
I am quite new in C++ and ITK and probably i'm missing something. can someone help me?<br>
Regards,<br>
Alessio<br>
______________________________<u></u>_______<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/<u></u>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_<u></u>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/<u></u>listinfo/insight-users</a><br>
</blockquote></div><br></div></div></div></div></div></div></div>