[Insight-users] About C++ template problem In ITK.

Wei-Dong Lian weidong.lian at gmail.com
Mon Dec 8 08:50:52 EST 2008


I have written a c++template class, I want to separate declaration and
implementation into two file(".h, .cc"). As that, when referencing to this
class that I exported into shared linked library(so) in Linux, the compiler
indicated "the undefined reference to these member function in that class".
If I put both the declaration and implementation into one file, it works
well.
I have searched this problem in Google and there is two solutions, one is to
write declaration and implementation in one header file; the other is to use
the C++ keyword "export", but it seems that GNU does not support this
keyword. Only few C++ compilers support this.
I found in the source code of ITK, it separate the declaration and
implementation of the template class into separated file(.h file and .cc
file). So can anyone give me some suggestions for this problem. Thanks a lot
for your help.
Weidong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081208/2e39f6bd/attachment.htm>


More information about the Insight-users mailing list