[Insight-users] Linking problem when using itk

nadan zhu nadan.zhu at gmail.com
Fri Feb 13 21:30:05 EST 2009


Hi
 You just need to change "importITK.cpp" to "importITK.h" and include it in
your "test.cxx"



On Sat, Feb 14, 2009 at 6:43 AM, 李健 <rongx2 at live.cn> wrote:

>
> Linking CXX executable test
> CMakeFiles/test.dir/test.o(.text+0x1be): In function `main':
> /home/src/itk/test.cxx:23: undefined reference to `importITK<unsigned
> short, 2u>::importITK(unsigned int*, unsigned short*)'
> CMakeFiles/test.dir/test.o(.text+0x20d):/home/src/itk/test.cxx:28:
> undefined reference to `importITK<unsigned short, 2u>::GetOutput()'
> collect2: ld returned 1 exit status
> make[2]: *** [test] Error 1
> make[1]: *** [CMakeFiles/test.dir/all] Error 2
> make: *** [all] Error 2
>
>
> importITK is the name of the class I created. In main() funtion,
> I just invoked some member functions of the class importITK.
>
> Thanks a lot.
>
>
>
> ------------------------------
>
>
> Date: Fri, 13 Feb 2009 21:29:04 +0200
> Subject: Re: [Insight-users] Linking problem when using itk
> From: ufukmat at gmail.com
> To: rongx2 at live.cn
>
> Could you please give the details of the errors.
>
>
>
> On Fri, Feb 13, 2009 at 9:22 PM, 李健 <rongx2 at live.cn> wrote:
>
> Dear all:
>
> I wrote a class to implement some member functions of itk using Linux. The
> class declaration is in a flie named by importITK.h, and the class
> definition is in a file named by importITK.cpp. And I wrote a fuction main()
> in a file named by test.cxx to invoke that class. I included all needed
> header files in three files. But something's wrong during liking in main()
> function: undefined reference to member functions of the class I created.
>
> Here is my CMakeLists.txt:
>
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
>   MESSAGE(FATAL_ERROR
>           "ITK not found. Please set ITK_DIR.")
> ENDIF(ITK_FOUND)
> ADD_EXECUTABLE(test test.cxx importITK.cpp)
> TARGET_LINK_LIBRARIES(test ITKCommon ITKBasicFilters ITKIO)
>
>
> I think maybe something's wrong about the CmakeLists.txt I wrote.
>
> Thanks a lot.
>
> ------------------------------
> MSN 9.0 正式版上线,捆绑免费25G网络硬盘! 立刻下载! <http://im.live.cn/msn9/>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
>
>
>
> --
> Ufuk MAT
> Research Assistant
>
> Bogazici University
> Institute of Biomedical Engineering
> 34342, Bebek/Istanbul
>
> Phone : +90 533 484 6301
> Fax     : +90 212 257 5030
>
>
>
>
>
> ------------------------------
> 使用新一代 Windows Live Mess enger 轻松交流和共享! 立刻下载!<http://im.live.cn/messenger.aspx>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090214/777f6412/attachment.htm>


More information about the Insight-users mailing list