<div>Hi Nikhil, </div><div>Here is an example of building a "hello world" project with ITK:</div><a href="http://insightsoftwareconsortium.github.com/ITKBarCamp-doc/ITK/HelloWorld/index.html">http://insightsoftwareconsortium.github.com/ITKBarCamp-doc/ITK/HelloWorld/index.html</a><div>
Looks like you are missing: <b>include( ${ITK_USE_FILE} )</b></div><div><b><br></b></div><div>Highly encourage you to use ITK v4:<a href="http://sourceforge.net/projects/itk/files/itk/4.3/InsightToolkit-4.3.1.tar.gz/download">http://sourceforge.net/projects/itk/files/itk/4.3/InsightToolkit-4.3.1.tar.gz/download</a></div>
<div><br></div><div>Hope this helps.</div><div>-Xiaoxiao<br><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 12:55 PM, Nikhil Chandra <span dir="ltr"><<a href="mailto:nsc2124@columbia.edu" target="_blank">nsc2124@columbia.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="font-family:courier new,monospace">Hello,</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">I recently installed ITK v3 on a CentOS 6 machine using ccmake with the following options:</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace;color:rgb(51,51,255)">BUILD_DOXYGEN OFF</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)">
<span style="font-family:courier new,monospace;color:rgb(51,51,255)">BUILD_EXAMPLES ON</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)"><span style="font-family:courier new,monospace;color:rgb(51,51,255)">BUILD_SHARED_LIBS ON</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)">
<span style="font-family:courier new,monospace;color:rgb(51,51,255)">BUILD_TESTING OFF</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)"><span style="font-family:courier new,monospace;color:rgb(51,51,255)">CMAKE_BACKWARDS_COMPATIBILITY 2.0</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)">
<span style="font-family:courier new,monospace;color:rgb(51,51,255)">CMAKE_BUILD_TYPE Release</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)"><span style="font-family:courier new,monospace;color:rgb(51,51,255)">CMAKE_INSTALL_PREFIX /usr/local</span><br style="font-family:courier new,monospace;color:rgb(51,51,255)">
<span style="font-family:courier new,monospace"><span style="color:rgb(51,51,255)">ITK_USE_KWSTYLE OFF</span><br><br>After pressing c + g inside ccmake, I followed this up with sudo make, and sudo make install.<br>
<br>I next installed VTK with the following options:<br><br><span style="font-family:courier new,monospace;color:rgb(51,51,255)">BUILD_EXAMPLES</span><span style="color:rgb(51,51,255)"> ON</span></span><br style="font-family:courier new,monospace;color:rgb(51,51,255)">
<span style="font-family:courier new,monospace;color:rgb(51,51,255)">BUILD_SHARED_LIBS ON<br>BUILD_TESTING ON<br>CMAKE_BACKWARDS_COMPATIBILITY 2.0<br>CMAKE_BUILD_TYPE Debug<br>
CMAKE_INSTALL_PREFIX /usr/local<br>OpenQube_DIR OpenQube_DIR_NOTFOUND<br>QT_QMAKE_EXECUTABLE QT_QMAKE_EXECUTABLE-NOTFOUND<br>VTKMY_WRAP_TCL ON<br>
VTK_DATA_ROOT VTK_DATA_ROOT-NOTFOUND<br>VTK_EXTRA_COMPILER_WARNINGS OFF<br>VTK_LARGE_DATA_ROOT VTK_LARGE_DATA_ROOT-NOTFOUND<br>VTK_USE_CHARTS ON<br>VTK_USE_CHEMISTRY ON<br>
VTK_USE_GEOVIS ON<br>VTK_USE_INFOVIS ON<br>VTK_USE_N_WAY_ARRAYS ON<br>VTK_USE_PARALLEL ON<br>VTK_USE_QT OFF<br>VTK_USE_QTCHARTS OFF<br>
VTK_USE_RENDERING ON<br>VTK_USE_TEXT_ANALYSIS OFF<br>VTK_USE_VIEWS ON<br>VTK_WRAP_JAVA OFF<br>VTK_WRAP_PYTHON OFF<br>VTK_WRAP_PYTHON_SIP OFF<br>
VTK_WRAP_TCL</span><span style="font-family:courier new,monospace"><span style="color:rgb(51,51,255)"> ON</span><br><br>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.<br>
<br>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:<br><br><span style="color:rgb(51,51,255)">#include <cstdlib></span><br style="color:rgb(51,51,255)">
<br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">using namespace std;</span><br style="color:rgb(51,51,255)"><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">/*</span><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)"> * </span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)"> */</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">int main(int argc, char** argv) {</span><br style="color:rgb(51,51,255)">
<br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)"> return 0;</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">}</span><br><br>I then tried to create a new Makefile using ccmake, by writing the following code in CMakeLists.txt:<br>
<br style="color:rgb(255,0,0)">
<span style="color:rgb(51,51,255)">cmake_minimum_required(VERSION 2.8)</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">project(ITKRegistration1)</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">add_executable(ITKRegistration1 main.cpp)</span><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)">find_package(ITK)</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">if (ITK_FOUND)</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)"> include_directories(${ITK_INCLUDE_DIRS})</span><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)">
target_link_libraries (ITKRegistration1 ${ITK_LIBRARIES})</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">endif (ITK_FOUND)</span><br style="color:rgb(51,51,255)"><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)">find_package(VTK)</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">if (VTK_FOUND)</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)"> include_directories(${VTK_INCLUDE_DIRS})</span><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)">
target_link_libraries (ITKRegistration1 ${VTK_LIBRARIES})</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">endif (VTK_FOUND)</span><br style="color:rgb(51,51,255)"><br>After hitting c + g, I tried running make, and I got the following error message:<br>
<br><span style="color:rgb(51,51,255)">Scanning dependencies of target ITKRegistration1</span><br style="color:rgb(51,51,255)"><span style="color:rgb(51,51,255)">[100%] Building CXX object CMakeFiles/ITKRegistration1.dir/main.cpp.o</span><br style="color:rgb(51,51,255)">
<span style="color:rgb(51,51,255)">Linking CXX executable ITKRegistration1</span><br style="color:rgb(51,51,255)"><span style="color:rgb(255,0,0)">/usr/bin/ld: cannot find -lITKAlgorithms</span><br style="color:rgb(255,0,0)">
<span style="color:rgb(255,0,0)">collect2: ld returned 1 exit status</span><br style="color:rgb(255,0,0)"><span style="color:rgb(255,0,0)">make[2]: *** [ITKRegistration1] Error 1</span><br style="color:rgb(255,0,0)"><span style="color:rgb(255,0,0)">make[1]: *** [CMakeFiles/ITKRegistration1.dir/all] Error 2</span><br style="color:rgb(255,0,0)">
<span style="color:rgb(255,0,0)">make: *** [all] Error 2</span><br style="color:rgb(255,0,0)"><br>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?<br>
<br>Any input would be appreciated, and thanks.<span class="HOEnZb"><font color="#888888"><br><br>Nikhil Chandra<br>
</font></span></span>
<br>_____________________________________<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/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/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_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/listinfo/insight-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><br></div><div><br></div>---------------------------------------------<br><b>Xiaoxiao Liu</b>, Ph.D.<div><div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">R & D Engineer</span></font></div>
<div><div><a href="http://www.kitware.com/" target="_blank">Kitware Inc</a>.</div></div><div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">Clifton Park, NY</span><div><div>Phone: (518) 881-4924 or <span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">(518) 371-3971 x124</span></div>
<div><font face="Verdana, Arial, Helvetica, sans-serif"><span style="line-height:31px;font-size:x-small"><br></span></font></div></div></div></div></div>
</div>