[Insight-users] Trouble setting up ITK project

Nikhil Chandra nsc2124 at columbia.edu
Fri Feb 22 12:55:42 EST 2013


Hello,

I recently installed ITK v3 on a CentOS 6 machine using ccmake with the
following options:

BUILD_DOXYGEN                         OFF
BUILD_EXAMPLES                        ON
BUILD_SHARED_LIBS                     ON
BUILD_TESTING                         OFF
CMAKE_BACKWARDS_COMPATIBILITY         2.0
CMAKE_BUILD_TYPE                      Release
CMAKE_INSTALL_PREFIX                  /usr/local
ITK_USE_KWSTYLE                       OFF

After pressing c + g inside ccmake, I followed this up with sudo make, and
sudo make install.

I next installed VTK with the following options:

BUILD_EXAMPLES                      ON
BUILD_SHARED_LIBS                   ON
BUILD_TESTING                       ON
CMAKE_BACKWARDS_COMPATIBILITY       2.0
CMAKE_BUILD_TYPE                    Debug
CMAKE_INSTALL_PREFIX                /usr/local
OpenQube_DIR                        OpenQube_DIR_NOTFOUND
QT_QMAKE_EXECUTABLE                 QT_QMAKE_EXECUTABLE-NOTFOUND
VTKMY_WRAP_TCL                      ON
VTK_DATA_ROOT                       VTK_DATA_ROOT-NOTFOUND
VTK_EXTRA_COMPILER_WARNINGS         OFF
VTK_LARGE_DATA_ROOT                 VTK_LARGE_DATA_ROOT-NOTFOUND
VTK_USE_CHARTS                      ON
VTK_USE_CHEMISTRY                   ON
VTK_USE_GEOVIS                      ON
VTK_USE_INFOVIS                     ON
VTK_USE_N_WAY_ARRAYS                ON
VTK_USE_PARALLEL                    ON
VTK_USE_QT                          OFF
VTK_USE_QTCHARTS                    OFF
VTK_USE_RENDERING                   ON
VTK_USE_TEXT_ANALYSIS               OFF
VTK_USE_VIEWS                       ON
VTK_WRAP_JAVA                       OFF
VTK_WRAP_PYTHON                     OFF
VTK_WRAP_PYTHON_SIP                 OFF
VTK_WRAP_TCL                        ON

Again, after pressing c + g inside ccmake, I ran sudo make, and sudo make
install. In retrospect, I probably should have set BUILD_TESTING to OFF and
CMAKE_BUILD_TYPE to Release, but I don't think that this would have any
bearing on the problem I am facing currently.

My next action was to create a new C++ project called ITKRegistration1 in
my home directory, using NetBeans. Here is the code that is currently in
main.cpp:

#include <cstdlib>

using namespace std;

/*
 *
 */
int main(int argc, char** argv) {

    return 0;
}

I then tried to create a new Makefile using ccmake, by writing the
following code in CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(ITKRegistration1)
add_executable(ITKRegistration1 main.cpp)
find_package(ITK)
if (ITK_FOUND)
    include_directories(${ITK_INCLUDE_DIRS})
     target_link_libraries (ITKRegistration1 ${ITK_LIBRARIES})
endif (ITK_FOUND)

find_package(VTK)
if (VTK_FOUND)
    include_directories(${VTK_INCLUDE_DIRS})
     target_link_libraries (ITKRegistration1 ${VTK_LIBRARIES})
endif (VTK_FOUND)

After hitting c + g, I tried running make, and I got the following error
message:

Scanning dependencies of target ITKRegistration1
[100%] Building CXX object CMakeFiles/ITKRegistration1.dir/main.cpp.o
Linking CXX executable ITKRegistration1
/usr/bin/ld: cannot find -lITKAlgorithms
collect2: ld returned 1 exit status
make[2]: *** [ITKRegistration1] Error 1
make[1]: *** [CMakeFiles/ITKRegistration1.dir/all] Error 2
make: *** [all] Error 2

In terminal, I ran the command: find /usr/local/itk -iname "*.so", and
there is a file called libITKAlgorithms.so located in /usr/local/itk/bin,
so I am not sure why this error message is taking place. Have I missed a
step during the installation of ITK? Is there something wrong with the code
I wrote for CMakeLists.txt?

Any input would be appreciated, and thanks.

Nikhil Chandra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130222/9bee8f28/attachment.htm>


More information about the Insight-users mailing list