[Insight-users] Linking problem when using itk

李健 rongx2 at live.cn
Fri Feb 13 14:43:19 EST 2009


Linking CXX executable testCMakeFiles/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 statusmake[2]: *** [test] Error 1make[1]: *** [CMakeFiles/test.dir/all] Error 2make: *** [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 +0200Subject: Re: [Insight-users] Linking problem when using itkFrom: ufukmat at gmail.comTo: rongx2 at live.cnCould 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网络硬盘! 立刻下载!_____________________________________Powered by www.kitware.comVisit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.htmlPlease keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQFollow this link to subscribe/unsubscribe:http://www.itk.org/mailman/listinfo/insight-users-- Ufuk MATResearch AssistantBogazici UniversityInstitute of Biomedical Engineering34342, Bebek/IstanbulPhone : +90 533 484 6301Fax     : +90 212 257 5030
_________________________________________________________________
MSN安全保护中心,免费修复系统漏洞,保护MSN安全!
http://im.live.cn/safe/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090214/69a47ee4/attachment.htm>


More information about the Insight-users mailing list