[Insight-users] (update) how to create ITK dll with visual c++
6.0?
Haris Saybasili
haris.saybasili at gmail.com
Mon May 1 07:04:41 EDT 2006
Hi Luis,
my CMakeLists.txt file is:
-----------------------------------------------------
PROJECT(myitk)
# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build without ITK. Please set ITK_DIR.")
ENDIF(ITK_FOUND)
ADD_LIBRARY(mytik SHARED myitk.cxx)
---------------------------------------------------------------------------
Thanks a lot,
haris
On 5/1/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
>
> Hi Haris
>
> Please post the CMakeLists.txt file that you wrote for this project.
>
> Thanks
>
>
> Luis
>
>
>
> ====================
> Haris Saybasili wrote:
> > Hi,
> >
> > I tried cmake, it created the project. However, Visual C++ couldn't
> > compile it. I had 44 errors, all of which was unresolved references. I
> > added additional lib and include libraries to the project, but no luck.
> > I exported the makefile, and edited it. I get the same error as always:
> >
> > .................
> > Searching C:\ITK\bin\bin\Debug\itksys.lib:
> > Searching C:\MSVStudio6\VC98\lib\kernel32.lib:
> > Searching C:\MSVStudio6\VC98\lib\user32.lib:
> > Searching C:\MSVStudio6\VC98\lib\gdi32.lib:
> > Searching C:\MSVStudio6\VC98\lib\winspool.lib:
> > Searching C:\MSVStudio6\VC98\lib\comdlg32.lib:
> > Searching C:\MSVStudio6\VC98\lib\advapi32.lib:
> > Searching C:\MSVStudio6\VC98\lib\shell32.lib:
> > Searching C:\MSVStudio6\VC98\lib\ole32.lib:
> > Searching C:\MSVStudio6\VC98\lib\oleaut32.lib:
> > Searching C:\MSVStudio6\VC98\lib\uuid.lib:
> > Searching C:\MSVStudio6\VC98\lib\odbc32.lib:
> > Searching C:\MSVStudio6\VC98\lib\odbccp32.lib:
> > Searching C:\MSVStudio6\VC98\lib\msvcrtd.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKAlgorithms.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKBasicFilters.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKCommon.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKDICOMParser.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKEXPAT.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKFEM.lib:
> > Searching C:\ITK\bin\bin\Debug\itkgdcm.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKIO.lib:
> > Searching C:\ITK\bin\bin\Debug\itkjpeg8.lib:
> > Searching C:\ITK\bin\bin\Debug\itkjpeg12.lib:
> > Searching C:\ITK\bin\bin\Debug\itkjpeg16.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKMetaIO.lib:
> > Searching C:\ITK\bin\bin\Debug\itknetlib.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKniftiio.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKNrrdIO.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKNumerics.lib:
> > Searching C:\ITK\bin\bin\Debug\itkpng.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKSpatialObject.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKStatistics.lib:
> > Searching C:\ITK\bin\bin\Debug\itktestlib.lib:
> > Searching C:\ITK\bin\bin\Debug\itktiff.lib:
> > Searching C:\ITK\bin\bin\Debug\itkvcl.lib:
> > Searching C:\ITK\bin\bin\Debug\itkvnl.lib:
> > Searching C:\ITK\bin\bin\Debug\itkvnl_algo.lib:
> > Searching C:\ITK\bin\bin\Debug\itkvnl_inst.lib:
> > Searching C:\ITK\bin\bin\Debug\itkzlib.lib:
> > Searching C:\ITK\bin\bin\Debug\ITKznz.lib:
> > Searching C:\MSVStudio6\VC98\lib\OLDNAMES.lib:
> > Searching C:\MSVStudio6\VC98\lib\msvcprtd.lib:
> > Searching C:\ITK\bin\bin\Debug\itksys.lib:
> > Searching C:\MSVStudio6\VC98\lib\kernel32.lib:
> > Searching C:\MSVStudio6\VC98\lib\user32.lib:
> > Done Searching Libraries
> > myitk.obj : error LNK2001: unresolved external symbol "class
> > std::basic_ostream<char,struct std::char_traits<char> > std::cout"
> > (?cout at std@@3V?$basic_ostream at DU?$char_traits at D@std@@@1 at A)
> > myitk.obj : error LNK2001: unresolved external symbol "__int64 const
> > std::_Fpz" (?_Fpz at std@@3_JB)
> > myitk.obj : error LNK2001: unresolved external symbol "private: static
> > class std::locale::_Locimp * std::locale::_Locimp::_Global"
> > (?_Global at _Locimp@ locale at std@@0PAV123 at A)
> > myitk.obj : error LNK2001: unresolved external symbol "private: static
> > int std::locale::id::_Id_cnt" (?_Id_cnt at id@locale at std@@0HA)
> > .\Debug\myitk.dll : fatal error LNK1120: 4 unresolved externals
> >
> >
> > I had searched the net, and saw that these kind of errors are very
> > common to vc++ 6.0. Is there anybody who succeded in creating an ITK DLL
> > with msvc++ 6.0?
> >
> > I am new to windows application development (I use linux normally), so
> > maybe I made a very elemental error.
> >
> > Thanks,
> >
> > haris
> >
> > PS: And for the DLL part, my code was like this:
> >
> > ----------------
> > 1. myitk.h:
> > ----------------
> >
> > #ifndef __HELLO_H
> > #define __HELLO_H
> > #ifndef __HELLO__
> > #define __HELLOLIB__ __declspec(dllimport)
> > #else
> > #define __HELLOLIB__ __declspec(dllexport)
> > #endif
> > __HELLOLIB__ int myitkhello() ;
> > #endif
> >
> > #include "C:\ITK\src\Code\Common\itkWin32Header.h"
> > #include "itkImage.h"
> >
> >
> > class myitk
> > {
> > public:
> >
> > myitk();
> >
> > ~myitk();
> >
> > };
> >
> > ----------------
> > myitk.cpp:
> > ----------------
> >
> > #define __HELLO__
> > #include "myitk.h"
> >
> > myitk::myitk() {
> >
> >
> > typedef itk::Image< unsigned short, 3 > ImageType;
> >
> > ImageType::Pointer image = ImageType::New();
> > std::cout << "ITK Hello World !" << std::endl;
> > FILE *f;
> > f = fopen("c:/temp/itk.txt","w");
> > fprintf(f,"itk : hello world!!!\n");
> > fclose(f);
> >
> > }
> >
> >
> > myitk::~myitk()
> > {
> >
> > }
> >
> > __HELLOLIB__ int myitkhello() {
> >
> > myitk mtk();
> > return 0;
> > }
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060501/199c5948/attachment-0001.htm
More information about the Insight-users
mailing list