Ubuntu16.04中PCL的bug
我使用ubuntu16.04,build时显示:
/usr/bin/ld: cannot find -lvtkproj4
collect2: error: ld returned 1 exit status
CMakeFiles/joinMap.dir/build.make:350: recipe for target ‘joinMap’ failed
make[2]: *** [joinMap] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/joinMap.dir/all’ failed
Makefile:83: recipe for target ‘all’ failed
make[1]: *** [CMakeFiles/joinMap.dir/all] Error 2
make: *** [all] Error 2
*** Failure: Exit code 2 ***
怎么解决?
把CMakeLists.txt 加一句代码list(REMOVE_ITEM PCL_LIBRARIES “vtkproj4”)
cmake_minimum_required( VERSION 2.8 )
project( joinMap )
set( CMAKE_BUILD_TYPE Release )
set( CMAKE_CXX_FLAGS "-std=c++11 -O3" )
# opencv
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
# eigen
include_directories( "/usr/include/eigen3/" )
# pcl
find_package( PCL REQUIRED COMPONENT common io )
include_directories( ${PCL_INCLUDE_DIRS} )
add_definitions( ${PCL_DEFINITIONS} )
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
add_executable( joinMap joinMap.cpp )
target_link_libraries( joinMap ${OpenCV_LIBS} ${PCL_LIBRARIES} )