[ITK] [ITK-users] Undefined references to methods of template classes

Matt McCormick matt.mccormick at kitware.com
Fri Jan 9 15:02:52 EST 2015


Hi Francisco,

In order for the templates to be available in the library, they must
be explicitly instantiated [1].

HTH,
Matt

[1] http://www.cplusplus.com/articles/1C75fSEw/

On Fri, Jan 9, 2015 at 2:59 PM, Francisco Lopez de la Franca
<franciscolopezdelafranca at gmail.com> wrote:
> Hi.
> I' like to create a library containing, for example, one template class with
> a number of methods.
> I've programmed a simple example and the compilation and generation of the
> library goes fine. I use the cmake "add_library" command for generating the
> library.
>
> The problem arises at the moment of testing the library. I get an undefined
> reference for every method in the template class.
>
> I've downloaded a tool to look in the contents (functions) of dynamic
> libraries, and there is no function in the library. If I add another class
> (not a template class), then, this tool shows me only the functions in this
> latter class.
>
> Has anyone ever come across with this problem?
>
> Thanks a lot in advance.
> Regards
> /Francisco
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list