[Insight-users] Problem for building DLL from ITK

Luis Ibanez luis.ibanez at kitware.com
Mon Apr 21 18:36:51 EDT 2008


Hi Bo,

Could you please post to the mailing list the source code
of the ITKLib32.cpp file ?

It is likely that you are missig some export symbols of the type:

    __declspec(dllexport)
    __declspec(dllimport)


Thanks


     Luis


------------------
Bo Zhou wrote:
> Hi All,
>   I've been trying to build a DLL from ITK using MSDEV 6.0. However I encountered some problems and hope someone can help me and I really appreciate.
> 
>   To be simple enough, my test followed these steps:
> 
> 1. I used wizard-generated source files from MSDEV and put them together with the following Cmakelist.txt file.
>     ---------------------------------------------------------------  
>     PROJECT(ITKLib)
> 
>     # 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(ITKLib SHARED ITKLib32.cpp StdAfx.cpp) 
>     --------------------------------------------------------------
> 2. Cmake 2.4 was used to configure the project and the project was built into another directory.(Cmake did find the ITK directory)
> 3. I opened the generated project and built all. Following messages appeared:
>     D:\Image_Registration\Program\ITKLib\ITKLib32.cpp(25) : error C2491: 'nITKLib32' : definition of dllimport data not allowed
>     D:\Image_Registration\Program\ITKLib\ITKLib32.cpp(29) : error C2491: 'fnITKLib32' : definition of dllimport function not allowed
>     D:\Image_Registration\Program\ITKLib\ITKLib32.cpp(36) : warning C4273: 'CITKLib32::CITKLib32' : inconsistent dll linkage.  dllexport assumed.
> 
> 
>     The source files shall be ok because they are generated by wizard and I did generated DLL successfully without using Cmake.
>     Has anyone had the similar problem before? your guidline will be really helpful and I really appreciate it.
>  
>    Thanks and have a nice day!
> 
>  
> 
>    
>  				
> --------------
> Bo Zhou
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list