05-编译及运行问题收集

问题:执行kdtree搜索时报错

  • 详情:执行kdtree搜索时报错如下
undefined reference to `pcl::search::Search<pcl::PointXYZ>::getName[abi:cxx11]() const'
  • 解决:

添加如下include在文件开头

#include <pcl/search/impl/search.hpp>

问题:编译boost相关工程时报错

  • 详情:
/usr/bin/ld: CMakeFiles/CalibrationCamera_ex.dir/CalibrationCamera_ex.cpp.o: undefined reference to symbol '_ZN5boost10filesystem6detail13dir_itr_closeERPvS3_'
//usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.58.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
src/CMakeFiles/CalibrationCamera_ex.dir/build.make:129: recipe for target '../build/debug/bin/CalibrationCamera_ex' failed
  • 解决:

添加boost_filesystem在target_link_libraries

add_executable(CalibrationCamera_ex CalibrationCamera_ex.cpp )
target_link_libraries(CalibrationCamera_ex ${OpenCV_LIBRARIES} boost_filesystem)