[Insight-users] undefined reference Templated Class

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Sep 6 10:37:04 EDT 2007


Hi Lars,

Your gradient class is templated, so you have to include the cxx file  
at the end of the header to make it work.

#include "gradient.cxx"

Because of the template, you can't (easily) build the code in  
your .cxx file and put it in a shared object.

Regards,

Gaëtan




Le 6 sept. 07 à 16:28, Lars Nygard a écrit :

> hi everybody,
>
> Id really appreciate some help with this. I don't know if this has
> something to do with ITK or if it's just basic c++. Whenever I try
> to make an instance of gradient Im getting an undefined reference
> Linker error:
>
> Linking CXX executable generateProblems.exe
> CMakeFiles/generateProblems.dir/main.obj:main.cxx:(.text+0x288):  
> undefined reference to `gradient<it
> k::Image<unsigned short, 3u> >::gradient()'
> collect2: ld returned 1 exit status
> mingw32-make[2]: *** [generateProblems.exe] Error 1
> mingw32-make[1]: *** [CMakeFiles/generateProblems.dir/all] Error 2
> mingw32-make: *** [all] Error 2
>
> Ive attached both .h and cxx class, hope this works.
> thanks for any help.
> lars
>
>
>
>
>
> _________________________________________________________
> Alt i én. Få Yahoo! Mail med adressekartotek, kalender og
> notisblokk. http://no.mail.yahoo.com
> <gradient.cxx>
> <gradient.h>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users

--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Url : http://public.kitware.com/pipermail/insight-users/attachments/20070906/429bd8fe/PGP.pgp


More information about the Insight-users mailing list