<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Robert,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style=""><font face="verdana, sans-serif">BUILD_SHARED_LIBS OFF is the crucial setting. You can keep the rest of options on defaults.</font></div><div class="gmail_default" style=""><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font face="verdana, sans-serif">Your CMake code looks OK. You should execute the following from your folder:</font></div><div class="gmail_default" style=""><font face="monospace, monospace">cmake .</font></div><div class="gmail_default" style=""><font face="monospace, monospace">make</font></div><div class="gmail_default" style=""><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font face="verdana, sans-serif">During CMake step you should configure options (point to the itk-build folder which was configured with BUILD_SHARED_LIBS OFF</font><span style="font-family:verdana,sans-serif">). Afterwards, do not invoke </span><font face="monospace, monospace">g++</font><span style="font-family:verdana,sans-serif"> directly - invoke </span><font face="monospace, monospace">make</font><span style="font-family:verdana,sans-serif">, which supplies correct include directories </span><span style="font-family:verdana,sans-serif">and link</span><span style="font-family:verdana,sans-serif"> libraries </span><span style="font-family:verdana,sans-serif">so you don't run into a thousand errors.</span></div><div class="gmail_default" style=""><span style="font-family:verdana,sans-serif"><br></span></div><div class="gmail_default" style=""><span style="font-family:verdana,sans-serif">Regards,</span></div><div class="gmail_default" style=""><span style="font-family:verdana,sans-serif">Dženan</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 22, 2016 at 6:25 AM, <span dir="ltr"><<a href="mailto:Robert.Atwood@diamond.ac.uk" target="_blank">Robert.Atwood@diamond.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi,
<br>
Thanks, Dženan, for the hint. But, does anyone have specific information on exactly which options to set in each of: the ITK cmake options; and the project cmake options, or the plain g++ for building an external program to link to the library, for this to
work ? There appear to be a few that might be related to this. Because, so far, simply changing the build options of the ITK installation didn’t work. See below for even more details .<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Robert<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Options selected in the project:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ITK_DIR /dls_sw/apps/itk/itk-master-static/lib/cmake/ITK-4.10<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">In the ITK with installation to itk-master-static:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I have tried some combinations of these options but, you know, it takes a while to rebuild ITK even though the computer is pretty good.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">BUILD_POSITION_DEPENDENT_CODE OFF (I don’t think this should be ON because that really wouldn’t work? )
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">BUILD_SHARED_LIBS OFF (or ON)
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">CMAKE_CXX_FLAGS -fPIC (or default)
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">CMAKE_EXE_LINKER_FLAGS -fPIC (or default)
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">CMAKE_STATIC_LINKER_FLAGS (should this be set too? )<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The CMakeLists in the project file – only small modification from the original to ‘BUILD_OUTSIDE_INSIGHT_APPICATIONS’. The project builds using the Cmake makefile,
producing the library and the executable<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">But trying to build either the ‘main’ procedure provided with linking to that library, or even simplifying the ‘main’ to do virtually nothing except instantiate
the object, results in 1000 error messages of ‘undefined symbols’ <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 1 PROJECT(Example_ITKFilterLib)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 2<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 3 #REMOVED 'IF (BUILD_OUTSIDE_INSIGHT_APPLICATIONS)'<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 4<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 5 FIND_PACKAGE(ITK)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 6 IF(ITK_FOUND)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 7 INCLUDE(${ITK_USE_FILE})<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 8 ELSE(ITK_FOUND)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 9 MESSAGE(FATAL_ERROR<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">10 "Cannot build ITKApps without ITK. Please set ITK_DIR.")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">11 ENDIF(ITK_FOUND)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">12<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">13 #REMOVED 'ENDIF(BUILD_OUTSIDE_INSIGHT_APPLICATIONS)'<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">14<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">15 ADD_LIBRARY(Example_ITKFilterLib ITKFilterLib.cxx )<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">16 INSTALL_TARGETS(/lib Example_ITKFilterLib)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">17 TARGET_LINK_LIBRARIES(Example_ITKFilterLib ${ITK_LIBRARIES})<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">18<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">19 ADD_EXECUTABLE(Example_ITKFilterLibTest ITKFilterLibTest.cxx )<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">20 INSTALL_TARGETS(/bin Example_ITKFilterLibTest)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">21 TARGET_LINK_LIBRARIES(Example_ITKFilterLibTest Example_ITKFilterLib)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">build]$ ls -l<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">total 2508<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-rw-rw-r-- 1 kny48981 kny48981 14393 Mar 22 10:02 CMakeCache.txt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">drwxrwxr-x 6 kny48981 kny48981 4096 Mar 22 10:05 CMakeFiles<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-rwxrwxr-x 1 kny48981 kny48981 1417263 Mar 22 10:05 Example_ITKFilterLibTest<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">drwxrwxr-x 2 kny48981 kny48981 4096 Mar 22 10:02 ITKIOFactoryRegistration<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-rw-rw-r-- 1 kny48981 kny48981 7933 Mar 22 10:02 Makefile<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-rw-rw-r-- 1 kny48981 kny48981 1092874 Mar 22 10:05 libExample_ITKFilterLib.a<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">build]$ g++ -o testcomp ../ITKFilterLib/ITKFilterLibTest.cxx -I ../ITKFilterLib -L . -l Example_ITKFilterLib >& out &<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">… generates 1100 messages …<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 1 ./libExample_ITKFilterLib.a(ITKFilterLib.o): In function `itk::MemoryAllocationError::MemoryAllocationError(std::basic_string<char, std::char_traits<char>,
std::allocat<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 2 ITKFilterLib.cxx:(.text._ZN3itk21MemoryAllocationErrorC2ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC5ERKSsjS2_S2_]+0x39): undefined reference to `itk::ExceptionObject:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">…<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">1106 ITKFilterLib.cxx:(.text._ZNK3itk12NeighborhoodIPfLj3ENS_21NeighborhoodAllocatorIS1_EEE9PrintSelfERSoNS_6IndentE[itk::Neighborhood<float*, 3u, itk::NeighborhoodAllocato<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">1107 collect2: ld returned 1 exit status<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Minimal example main:
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 1 #include "ITKFilterLib.h"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 2 int main(int, char **) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 3 int inputDimSize[3];<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 4 float inputOrigin[3];<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 5 float inputSpacing[3];<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 6 inputDimSize[0] = 5;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 7 inputDimSize[1] = 5;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 8 inputDimSize[2] = 5;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 9 inputOrigin[0] = 0;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">10 inputOrigin[1] = 0;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">11 inputOrigin[2] = 0;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">12 inputSpacing[0] = 1;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">13 inputSpacing[1] = 1;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">14 inputSpacing[2] = 1;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">15<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">16 itkFilterLib filter(inputDimSize, inputOrigin, inputSpacing);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">17 return (true);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">18 }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">g++ -o testmin minimal_example.cxx -I ../ITKFilterLib -L . -l Example_ITKFilterLib >& out
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Same output AFAICT:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 1 ./libExample_ITKFilterLib.a(ITKFilterLib.o): In function `itk::MemoryAllocationError::MemoryAllocationError(std::basic_string<char, std::char_traits<char>,
std::alloca<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 2 ITKFilterLib.cxx:(.text._ZN3itk21MemoryAllocationErrorC2ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC5ERKSsjS2_S2_]+0x39): undefined reference to `itk::ExceptionObject:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">….<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Dženan Zukić [mailto:<a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a>]
<br>
<b>Sent:</b> 21 March 2016 20:21<br>
<b>To:</b> Atwood, Robert (DLSLtd,RAL,SCI)<br>
<b>Cc:</b> Insight-users<br>
<b>Subject:</b> Re: [ITK-users] stand-alone lib -- ITKApps/ITKFilterLib<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">Hi Robert,<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">maybe you need to link to ITK statically? To accomplish this you probably need to build ITK as static libraries (it is a configuration option in CMake).<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif""><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">Regards,<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">Dženan<u></u><u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, Mar 21, 2016 at 12:50 PM, <<a href="mailto:Robert.Atwood@diamond.ac.uk" target="_blank">Robert.Atwood@diamond.ac.uk</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">Hi,<br>
This example, ITKApps/ITKFilterLib, appears to be an example of what I want to do , bundle or encapsulate a specific ITK-based filter into a library so that another program may just call it without having to have the ITK source installation available.<br>
However, a basic test for me is not working.<br>
<br>
I just tried to compile the test example from command line after building the library with Cmake as usual. I get hundreds of 'undefined reference', as if I have to link with all the ITK libs anyways.<br>
Am I missing something?<br>
Thanks<br>
<br>
<br>
<br>
<br>
g++ -o testcomp ../ITKFilterLib/ITKFilterLibTest.cxx -I ../ITKFilterLib/ -L . -l Example_ITKFilterLib<br>
<br>
<br>
First few lines of output:<br>
<br>
./libExample_ITKFilterLib.a(ITKFilterLib.o): In function `itk::MemoryAllocationError::MemoryAllocationError(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':<br>
ITKFilterLib.cxx:(.text._ZN3itk21MemoryAllocationErrorC2ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC5ERKSsjS2_S2_]+0x39): undefined reference to `itk::ExceptionObject::ExceptionObject(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_trait<br>
ITKFilterLib.cxx:(.text._ZN3itk21MemoryAllocationErrorC2ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC5ERKSsjS2_S2_]+0x44): undefined reference to `vtable for itk::MemoryAllocationError'<br>
./libExample_ITKFilterLib.a(ITKFilterLib.o): In function `itk::ProcessAborted::ProcessAborted(char const*, unsigned int)':<br>
ITKFilterLib.cxx:(.text._ZN3itk14ProcessAbortedC2EPKcj[_ZN3itk14ProcessAbortedC5EPKcj]+0x33): undefined reference to `itk::ExceptionObject::ExceptionObject(char const*, unsigned int, char const*, char const*)'<br>
ITKFilterLib.cxx:(.text._ZN3itk14ProcessAbortedC2EPKcj[_ZN3itk14ProcessAbortedC5EPKcj]+0x3e): undefined reference to `vtable for itk::ProcessAborted'<br>
ITKFilterLib.cxx:(.text._ZN3itk14ProcessAbortedC2EPKcj[_ZN3itk14ProcessAbortedC5EPKcj]+0x4f): undefined reference to `itk::ExceptionObject::SetDescription(char const*)'<br>
ITKFilterLib.cxx:(.text._ZN3itk14ProcessAbortedC2EPKcj[_ZN3itk14ProcessAbortedC5EPKcj]+0x62): undefined reference to `itk::ExceptionObject::~ExceptionObject()'<br>
<br>
<br>
<br>
This is on a Linux Red Hat with ITK git master today (March 21 2016)<br>
<br>
cmake --version<br>
cmake version 2.8.12.2<br>
<br>
/proc/version:<br>
<br>
Linux version 2.6.32-573.18.1.el6.x86_64 (<a href="mailto:mockbuild@x86-010.build.bos.redhat.com" target="_blank">mockbuild@x86-010.build.bos.redhat.com</a>) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Wed Jan 6 11:20:49 EST 2016<br>
<br>
<br>
<br>
--<br>
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt
by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.<br>
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.<br>
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.<br>
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom<br>
<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://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div><div><div class="h5">
<p align="justify"> </p>
<p align="justify">-- </p>
<p align="justify">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.<br>Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. <br>Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.<br>Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom<br> </p></div></div></div>
</blockquote></div><br></div>