我有一个使用库的项目和一个ITK
可用于生成项目的文件。我现在正在尝试使用新的库()。它带有一个使用文件,我包含在其中以导入源代码和库。我遇到的问题是它没有正确生成库的正确路径。尝试编译项目时出现以下错误:VTK
CMakeLists
VMTK
CMake
CMakeLists
Creating library C:/itkProjects/repository/ITK_source/vmtk/vmtkcenterline/source/build/Debug/vmtkcenterline.lib and object C:/itkProjects/repository/ITK_source/vmtk/vmtkcenterline/source/build/Debug/vmtkcenterline.exp
2>vmtkcenterline.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkvmtkCapPolyData * __cdecl vtkvmtkCapPolyData::New(void)" (__imp_?New@vtkvmtkCapPolyData@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkvmtkCapPolyData> __cdecl vtkSmartPointer<class vtkvmtkCapPolyData>::New(void)" (?New@?$vtkSmartPointer@VvtkvmtkCapPolyData@@@@SA?AV1@XZ)
2>C:\itkProjects\repository\ITK_source\vmtk\vmtkcenterline\source\build\Debug\vmtkcenterline.exe : fatal error LNK1120: 1 unresolved externals
库应包含在CMake
使用文件中。这个usefile粘贴在下面:
INCLUDE(CMakeImportBuildSettings)
SET (VMTK_CPP_SOURCE_DIRS "C:/vmtk/source/vtkVmtk")
SET(VMTK_INCLUDE_DIRS
${VMTK_CPP_SOURCE_DIRS}
${VMTK_CPP_SOURCE_DIRS}/Common
${VMTK_CPP_SOURCE_DIRS}/ComputationalGeometry
${VMTK_CPP_SOURCE_DIRS}/Contrib
${VMTK_CPP_SOURCE_DIRS}/DifferentialGeometry
${VMTK_CPP_SOURCE_DIRS}/IO
${VMTK_CPP_SOURCE_DIRS}/Misc
${VMTK_CPP_SOURCE_DIRS}/Segmentation
"C:/vmtk/build/VMTK-Build"
"C:/vmtk/build/VMTK-Build/vtkVmtk"
"C:/vmtk/build/Install/include/vmtk"
"C:/vmtk/build/VMTK-Build/bin/Debug"
)
INCLUDE(
"C:/vmtk/build/VMTK-Build/VMTKLibraryDepends.cmake"
)
SET(VMTK_LIBRARY_DIRS "C:/vmtk/build/VMTK-Build/bin")
SET(VMTK_USE_FILE
"C:/vmtk/build/VMTK-Build/VMTKUse.cmake"
)
INCLUDE_DIRECTORIES(${VMTK_INCLUDE_DIRS})
LINK_DIRECTORIES(${VMTK_LIBRARY_DIRS})
LINK_LIBRARIES(vtkvmtkCommon vtkvmtkComputationalGeometry vtkvmtkContrib vtkvmtkDifferentialGeometry vtkvmtkIO vtkvmtkITK vtkvmtkMisc vtkvmtkSegmentation nl tet)
如何正确包含库?库的直接路径是:
C:\vmtk\build\VMTK-Build\bin\Debug
我可以直接设置它们的路径吗?
PS:如果它有帮助,CMakeLists
就在这里。