我在我的应用程序中使用DCMTK并使用cmake文件进行编译。 cmake找到所有库(至少是头文件,因为在编译源文件到.o文件时)唯一的问题是在链接期间它试图找到DCMTK的动态库。我把一个编译为静态,所以我没有.so文件。结果它给了我错误:No rule to make target /usr/lib/libdcmdata.so, needed by dcm_seg. Stop.
我使用的是Ubuntu 14.04 x64。
它让我很困惑。那么,问题是什么?
cmake文件:
cmake_minimum_required(VERSION 2.6)
project(dcm_segm)
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS} -g -ftest-coverage -fprofile-arcs")
set(Boost_USE_STATIC_LIBS ON)
set(OpenCV_USE_STATIC_LIBS ON)
set(DCMTK_USE_STATIC_LIBS ON)
set(OpenCV_STATIC ON)
find_package( VTK REQUIRED )
find_package( OpenCV REQUIRED )
find_package( Boost COMPONENTS system filesystem REQUIRED )
find_package( DCMTK REQUIRED )
include(${VTK_USE_FILE} )
link_directories(${OpenCV_LIB_DIR})
add_executable(dcm_seg main.cpp DICOMin.cpp Ensemble.cpp Ensemble3dExtension.cpp point_3d.cpp RegionGrow.cpp)
target_link_libraries(dcm_seg ${VTK_LIBRARIES} ${OpenCV_LIBS} ${DCMTK_LIBRARIES} ${Boost_LIBRARIES})
答案 0 :(得分:0)
您可以查看$ {DCMTK_LIBRARIES}的内容(它应该是DCMTK静态库的路径列表)吗?
您还可以在CMake配置期间检查以下CMake条目:
errorLabelContainer
另一个提示:我过去曾指出,从构建而不是安装中找到DCMTK并不总能正常运行。
如果您在使用CMake提供的脚本时无法找到DCMTK
( DCMTK_DIR /path/to/DCMTK/install
DCMTK_config_INCLUDE_DIR /path/to/DCMTK/install/include/dcmtk/config
DCMTK_dcmdata_INCLUDE_DIR /path/to/DCMTK/install/dcmdata/include/dcmtk/dcmdata
DCMTK_dcmdata_LIBRARY_DEBUG /path/to/DCMTK/install/dcmdata/libsrc/libdcmdata.a
DCMTK_dcmdata_LIBRARY_RELEASE /path/to/DCMTK/install/dcmdata/libsrc/libdcmdata.a
[...]
并不满足您的静态DCMTK库的路径)您可以尝试使用此alternative script