<div dir="ltr">Thanks to your previous answer the problem was solved, but another one has come out. It occurs when linking to create the library. It gives an undefined reference to itk::ExceptionObject::ExceptionObject... as you can see below.<br>What it is strange to me is that before including explicit template instantiation, I created the library without errors, and now that I include that, I get this error.<br> I'll appreciate very much any help.<br><br>Linking CXX shared library libTFM_Features.dll<br>CMakeFiles\TFM_Features.dir/objects.a(TFM_Features.cpp.obj):TFM_Features.cpp:(.t<br>ext$_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC<br>1ERKSsjS2_S2_]+0x35): undefined reference to `itk::ExceptionObject::ExceptionObj<br>ect(std::string const&, unsigned int, std::string const&, std::string const&)'<br>CMakeFiles\TFM_Features.dir/objects.a(TFM_Features.cpp.obj):TFM_Features.cpp:(.t<br>ext$_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC<br>1ERKSsjS2_S2_]+0x40): undefined reference to `vtable for itk::MemoryAllocationEr<br>ror'<br>C:/CV/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-min<br>gw32/bin/ld.exe: CMakeFiles\TFM_Features.dir/objects.a(TFM_Features.cpp.obj): ba<br>d reloc address 0x40 in section `.text$_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_<br>S2_[_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_]'<br>collect2.exe: error: ld returned 1 exit status<br>SRC\CMakeFiles\TFM_Features.dir\build.make:219: recipe for target 'SRC/libTFM_Fe<br>atures.dll' failed<br>mingw32-make[2]: *** [SRC/libTFM_Features.dll] Error 1<br>CMakeFiles\Makefile2:77: recipe for target 'SRC/CMakeFiles/TFM_Features.dir/all'<br> failed<br>mingw32-make[1]: *** [SRC/CMakeFiles/TFM_Features.dir/all] Error 2<br>Makefile:74: recipe for target 'all' failed<br>mingw32-make: *** [all] Error 2<br><div class="gmail_extra"><br><div class="gmail_quote">2015-01-09 21:02 GMT+01:00 Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Francisco,<br>
<br>
In order for the templates to be available in the library, they must<br>
be explicitly instantiated [1].<br>
<br>
HTH,<br>
Matt<br>
<br>
[1] <a href="http://www.cplusplus.com/articles/1C75fSEw/" target="_blank">http://www.cplusplus.com/articles/1C75fSEw/</a><br>
<div><div class="h5"><br>
On Fri, Jan 9, 2015 at 2:59 PM, Francisco Lopez de la Franca<br>
<<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>> wrote:<br>
> Hi.<br>
> I' like to create a library containing, for example, one template class with<br>
> a number of methods.<br>
> I've programmed a simple example and the compilation and generation of the<br>
> library goes fine. I use the cmake "add_library" command for generating the<br>
> library.<br>
><br>
> The problem arises at the moment of testing the library. I get an undefined<br>
> reference for every method in the template class.<br>
><br>
> I've downloaded a tool to look in the contents (functions) of dynamic<br>
> libraries, and there is no function in the library. If I add another class<br>
> (not a template class), then, this tool shows me only the functions in this<br>
> latter class.<br>
><br>
> Has anyone ever come across with this problem?<br>
><br>
> Thanks a lot in advance.<br>
> Regards<br>
> /Francisco<br>
><br>
</div></div>> _____________________________________<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><br>
><br>
</blockquote></div><br></div></div>