我很高兴与cmake合作,而且有一个问题我无法找到解决方案:
我使用vtk
库并在CMakeLists.txt
文件中指定:
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
cmake_policy(SET CMP0053 OLD)
project (pcl-visualizer)
find_package (Qt4 REQUIRED)
find_package (VTK REQUIRED)
find_package (PCL 1.7.1 REQUIRED)
include_directories (${PCL_INCLUDE_DIRS})
link_directories (${PCL_LIBRARY_DIRS})
add_definitions (${PCL_DEFINITIONS})
set (project_SOURCES main.cpp pclviewer.cpp)
set (project_HEADERS pclviewer.h)
set (project_FORMS pclviewer.ui)
set (VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid QVTK)
QT4_WRAP_CPP (project_HEADERS_MOC ${project_HEADERS})
QT4_WRAP_UI (project_FORMS_HEADERS ${project_FORMS})
INCLUDE (${QT_USE_FILE})
ADD_DEFINITIONS (${QT_DEFINITIONS})
ADD_EXECUTABLE (pcl_visualizer ${project_SOURCES}
${project_FORMS_HEADERS}
${project_HEADERS_MOC})
TARGET_LINK_LIBRARIES (pcl_visualizer ${QT_LIBRARIES} ${PCL_LIBRARIES} ${VTK_LIBRARIES})
cmake也运行良好。它没有出错,所以我假设它可以找到所有的库,包括vtk
库?
当我运行make
时,我收到此错误消息:
[ 16%] Linking CXX executable pcl_visualizer
/usr/bin/ld: cannot find -lvtkRendering
/usr/bin/ld: cannot find -lvtkGraphics
/usr/bin/ld: cannot find -lvtkHybrid
/usr/bin/ld: cannot find -lQVTK
/usr/bin/ld: cannot find -lvtkRendering
/usr/bin/ld: cannot find -lvtkGraphics
/usr/bin/ld: cannot find -lvtkHybrid
/usr/bin/ld: cannot find -lQVTK
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/pcl_visualizer.dir/build.make:410: pcl_visualizer] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/pcl_visualizer.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
我通过包管理器(pacman,我运行arch linux)安装了vtk
库,所以它应该在一个标准目录中?
我检查了是否通过pacman -Q vtk
安装了正确的库,它列出了`/ usr / lib /``目录中所有需要的库。