2016-09-28 2 views
0

Я пытаюсь создать DLL-файл с CMake .Below мой CMakeLists.txtнеразрешенный внешний символ с CMake

# This is the root ITK CMakeLists file. 
cmake_minimum_required(VERSION 2.8.9) 
if(COMMAND CMAKE_POLICY) 
    cmake_policy(SET CMP0003 NEW) 
endif() 

SET(BUILD_SHARED_LIBS TRUE) 

SET(ITK_LIBRARIES 
    ITKIO 
    ITKCommon 
    ITKNumerics 
    ITKStatistics 
    ITKBasicFilters 
) 

# The header files 
SET(HEADERS 
    itkLookAtTransformInitializer.h 
    itkObliqueSectionImageFilter.h 
    obliquePlane.h 
) 

# The implementation files 
SET(SOURCES 
    itkLookAtTransformInitializer.txx 
    itkObliqueSectionImageFilter.txx 
    main.cxx 
    obliquePlane.cpp 
) 

# Find ITK. 
find_package(ITK REQUIRED) 
include(${ITK_USE_FILE}) 

# Add this as include directory 
INCLUDE_DIRECTORIES(
    ${CMAKE_SOURCE_DIR} 
    ${SOURCE_PATH} 
    ${VXL_INCLUDE_DIRS} 
) 

LINK_DIRECTORIES(${ITK_LIBRARIES}) 
# Main library 
#ADD_EXECUTABLE(LookAtMain ${HEADERS} ${SOURCES}) 
ADD_LIBRARY(ObliquePlane SHARED ${HEADERS} ${SOURCES}) 
TARGET_LINK_LIBRARIES(ObliquePlane ${ITK_LIBRARIES}) 

Я новичок как CMake и ИТК я получаю следующее сообщение об ошибке, когда я построить его :

obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GE5ImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GE4ImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::MRCImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::MetaImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::BioRadImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::StimulateImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::VTKImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::TIFFImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::PNGImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected][email protected]@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::LSMImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::BMPImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GDCMImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::JPEGImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::HDF5ImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GiplImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::NrrdImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected][email protected]@@YAXXZ) 
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::NiftiImageIOFactoryRegister__Private(void)" ([email protected]@@YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" ([email protected]?A0x44466 

ответ

0

Правильное использование find_package(ITK):

# All needed ITK components should be listed in find_package() call 
find_package(ITK REQUIRED COMPONENTS 
       ITKIO 
       ITKCommon 
       ITKNumerics 
       ITKStatistics 
       ITKBasicFilters 
) 

# These variables are set now: 
# ITK_LIBRARIES  = Libraries to link 
# ITK_INCLUDE_DIRS = Header file search path 
# ITK_LIBRARY_DIRS = Library search path (for outside dependencies) 
# ITK_RUNTIME_LIBRARY_DIRS = Runtime linker search path 
# 
# ITK_USE_FILE - The location of the UseITK.cmake file. 

# This call performs all settings except ITK_LIBRARIES, 
# which should be passed to target_link_libraries() call. 
include(${ITK_USE_FILE}) 

ADD_LIBRARY(ObliquePlane SHARED <...>) 
TARGET_LINK_LIBRARIES(ObliquePlane ${ITK_LIBRARIES}) 
+0

решен благодаря Цывареву – swetha

Смежные вопросы