[Insight-users] [Insight-developers] Problem linking libraries ITK-Cmake

Alessio Mazzarini alessiomazzarini89 at gmail.com
Wed Jan 8 16:48:31 EST 2014


Hello everyone. I have a problem to link together some libraries with my 
ITK project.
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".
In the header of MyOwnFilter i write: #include "OtherLibrary.h"
All of these files are in the same directory.
When i run Cmake no errors appear, but when i try to "make" the file in 
the directory the terminal gives me this error:

.....$ make
[100%] Building CXX object CMakeFiles/MyProject.dir/main.cxx.o
Linking CXX executable MyProject
/usr/bin/ld: cannot find -lOtherLibrary
collect2: ld returned 1 exit status
make[2]: *** [MyProject] Error 1
make[1]: *** [CMakeFiles/MyProject.dir/all] Error 2
make: *** [all] Error 2




My CmakeLists File is the following:

PROJECT (MyProject)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

FIND_PACKAGE (ITK REQUIRED)
INCLUDE (${ITK_USE_FILE})

ADD_EXECUTABLE (MyProject main.cxx)

TARGET_LINK_LIBRARIES(MyOwnFilter    OtherLibrary ${ITK_LIBRARIES})



I am quite new in C++ and ITK and probably i'm missing something. can 
someone help me?
Regards,
Alessio


More information about the Insight-users mailing list