<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Something similar happened to me when I switched from 14.04 to 16.04. You need to compile both ITK and the program which links against it using the same compiler i.e. you need to recompile ITK (do a clean build).</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Dženan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 7, 2016 at 12:13 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
You are using the installed Ubuntu version?<br>
<br>
Because I see “cxx11” in the string symbol below, I think there may be a miss match between the C++ versions used to compile ITK and what you use here in this example.<br>
<br>
I would try to determine which compiler and flags your ubuntu version of ITK was compiled with and try to use the same.<br>
<br>
Alternatively, you could just compile ITK from source.<br>
<br>
HTH,<br>
Brad<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
> On Sep 7, 2016, at 12:00 PM, soolijoo <<a href="mailto:mattghall@gmail.com">mattghall@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I've just upgraded to Ubuntu 16.04 from 14.04 and am having some strange<br>
> linker problems with my code.<br>
><br>
> Using the same CMakeLists.txt as previously the compiler is finding the ITK<br>
> headers but the build fails during the linking phase. This is happening even<br>
> for extremely simple, hello world type examples. For example the following<br>
> code:<br>
><br>
> #include "itkImage.h"<br>
> #include <iostream><br>
><br>
> int main(int argc, char** argv){<br>
><br>
>    typedef itk::Image<unsigned short, 3> ImageType;<br>
><br>
>    ImageType::Pointer image = ImageType::New();<br>
><br>
>    std::cout << "Hey there, ITK!" << std::endl;<br>
><br>
>    return 0;<br>
><br>
> }<br>
><br>
><br>
> with this CMakeLists.txt file:<br>
><br>
> cmake_minimum_required(VERSION 2.8)<br>
><br>
> project(SimpleMutInfo)<br>
><br>
> find_package(ITK REQUIRED)<br>
> include(${ITK_USE_FILE})<br>
> if(ITKVtGlue_LOADED)<br>
>    find_package(VTK REQUIRED)<br>
>    include(${VTK_USE_FILE})<br>
> endif()<br>
><br>
> add_executable(SimpleMutInfo simpleMutInfo.cpp)<br>
><br>
> MESSAGE(${ITK_LIBRARIES})<br>
><br>
> MESSAGE(${CMAKE_INSTALL_<wbr>PREFIX})<br>
> MESSAGE(${ITK_DIR})<br>
><br>
> if( "${ITK_VERSION_MAJOR}" LESS 4 )<br>
>    target_link_libraries(<wbr>SimpleMutInfo ITKReview ${ITK_LIBRARIES})<br>
> else( "${ITK_VERSION_MAJOR}" LESS 4 )<br>
>    target_link_libraries(<wbr>SimpleMutInfo ${ITK_LIBRARIES})<br>
> endif( "${ITK_VERSION_MAJOR}" LESS 4 )<br>
><br>
><br>
> completes the cmake apparently correctly:<br>
> -- The C compiler identification is GNU 5.4.0<br>
> -- The CXX compiler identification is GNU 5.4.0<br>
> -- Check for working C compiler: /usr/bin/cc<br>
> -- Check for working C compiler: /usr/bin/cc -- works<br>
> -- Detecting C compiler ABI info<br>
> -- Detecting C compiler ABI info - done<br>
> -- Detecting C compile features<br>
> -- Detecting C compile features - done<br>
> -- Check for working CXX compiler: /usr/bin/c++<br>
> -- Check for working CXX compiler: /usr/bin/c++ -- works<br>
> -- Detecting CXX compiler ABI info<br>
> -- Detecting CXX compiler ABI info - done<br>
> -- Detecting CXX compile features<br>
> -- Detecting CXX compile features - done<br>
> -- Configuring done<br>
> -- Generating done<br>
> -- Build files have been written to:<br>
> /home/matt/CodingProjects/<wbr>sandbox/mutInfo/itk/helloItk<br>
><br>
><br>
> but gives the following compiler error:<br>
> Scanning dependencies of target HelloItk<br>
> [ 50%] Building CXX object CMakeFiles/HelloItk.dir/<wbr>helloItk.cpp.o<br>
> [100%] Linking CXX executable HelloItk<br>
> CMakeFiles/HelloItk.dir/<wbr>helloItk.cpp.o: In function<br>
> `itk::MemoryAllocationError::<wbr>MemoryAllocationError(std::__<wbr>cxx11::basic_string<char,<br>
> std::char_traits&lt;char>, std::allocator<char> > const&, unsigned int,<br>
> std::__cxx11::basic_string<<wbr>char, std::char_traits&lt;char>,<br>
> std::allocator<char> > const&, std::__cxx11::basic_string<<wbr>char,<br>
> std::char_traits&lt;char>, std::allocator<char> > const&)':<br>
> helloItk.cpp:(.text._<wbr>ZN3itk21MemoryAllocationErrorC<wbr>2ERKNSt7__cxx1112basic_<wbr>stringIcSt11char_<wbr>traitsIcESaIcEEEjS8_S8_[_<wbr>ZN3itk21MemoryAllocationErrorC<wbr>5ERKNSt7__cxx1112basic_<wbr>stringIcSt11char_<wbr>traitsIcESaIcEEEjS8_S8_]+0x35)<wbr>:<br>
> undefined reference to<br>
> `itk::ExceptionObject::<wbr>ExceptionObject(std::__cxx11::<wbr>basic_string<char,<br>
> std::char_traits&lt;char>, std::allocator<char> > const&, unsigned int,<br>
> std::__cxx11::basic_string<<wbr>char, std::char_traits&lt;char>,<br>
> std::allocator<char> > const&, std::__cxx11::basic_string<<wbr>char,<br>
> std::char_traits&lt;char>, std::allocator<char> > const&)'<br>
> collect2: error: ld returned 1 exit status<br>
> CMakeFiles/HelloItk.dir/build.<wbr>make:204: recipe for target 'HelloItk' failed<br>
> make[2]: *** [HelloItk] Error 1<br>
> CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/HelloItk.dir/all'<br>
> failed<br>
> make[1]: *** [CMakeFiles/HelloItk.dir/all] Error 2<br>
> Makefile:83: recipe for target 'all' failed<br>
> make: *** [all] Error 2<br>
><br>
><br>
> I've confirmed that the i've installed all four ubuntu packages mentioned<br>
> here:<br>
> <a href="https://blog.kitware.com/itk-packages-in-linux-distributions/" rel="noreferrer" target="_blank">https://blog.kitware.com/itk-<wbr>packages-in-linux-<wbr>distributions/</a><br>
> (including the python bindings)<br>
><br>
> The itk libs seem to be in /usr/local/lib but for some reason the linker<br>
> isn't seeing them.<br>
><br>
> Anyone got any ideas?<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://itk-insight-users.2283740.n2.nabble.com/Linker-problems-since-Ubuntu-16-04-upgrade-tp7589172.html" rel="noreferrer" target="_blank">http://itk-insight-users.<wbr>2283740.n2.nabble.com/Linker-<wbr>problems-since-Ubuntu-16-04-<wbr>upgrade-tp7589172.html</a><br>
> Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>
> ______________________________<wbr>_______<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
<br>
______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br></div>