【错误解决】【SLAM14的cap5】【PCL库的pcl/visualization/pcl_visualizer.h的使用】【对‘pcl::visualizatio...’未定义的引用】
- 0 前言
- 1 报错提示
- 2 解决方法
- 3 参考文献
0 前言
1 报错提示
====================[ 构建 | joinMap | Debug ]====================================
/home/bupo/CLion-2022.1.2/clion-2022.1.2/bin/cmake/linux/bin/cmake --build /home/bupo/my_study/slam14/slam14_my/cap5/jointMap/cmake-build-debug --target joinMap -j 6
[1/1] Linking CXX executable joinMap
FAILED: joinMap
: && /usr/bin/c++ -O3 -DNDEBUG -rdynamic CMakeFiles/joinMap.dir/src/joinMap.cpp.o -o joinMap -Wl,-rpath,/usr/local/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/hdf5/openmpi:/usr/lib/x86_64-linux-gnu/openmpi/lib /usr/local/lib/x86_64-linux-gnu/libopencv_dnn.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_ml.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_objdetect.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_shape.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_stitching.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_superres.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_videostab.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_viz.so.3.4.1 -lboost_system -lboost_filesystem -lboost_thread -lpthread -lboost_date_time -lboost_iostreams -lboost_serialization -lboost_chrono -lboost_atomic -lboost_regex -lpcl_common -lpcl_octree -lOpenNI -lOpenNI2 -lfreetype -lz -lexpat -lpython2.7 /usr/lib/libvtkWrappingTools-6.3.a -ljpeg -lpng -ltiff -lsqlite3 -lproj /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so -lsz -ldl -lm /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so -lnetcdf_c++ -lnetcdf -lgl2ps -ltheoraenc -ltheoradec -logg -lxml2 -ljsoncpp -lpcl_io -lboost_system -lboost_filesystem -lboost_thread -lpthread -lboost_date_time -lboost_iostreams -lboost_serialization -lboost_chrono -lboost_atomic -lboost_regex -lOpenNI -lOpenNI2 -lfreetype -lz /usr/lib/x86_64-linux-gnu/libvtkDomainsChemistry-6.3.so.6.3.0 -lexpat /usr/lib/x86_64-linux-gnu/libvtkFiltersGeneric-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersHyperTree-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersParallelFlowPaths-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersParallelGeometry-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersParallelImaging-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersParallelMPI-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersParallelStatistics-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersProgrammable-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersPython-6.3.so.6.3.0 -lpython2.7 /usr/lib/libvtkWrappingTools-6.3.a /usr/lib/x86_64-linux-gnu/libvtkFiltersReebGraph-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersSMP-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersSelection-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersVerdict-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkverdict-6.3.so.6.3.0 -ljpeg -lpng -ltiff /usr/lib/x86_64-linux-gnu/libvtkGUISupportQtOpenGL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkGUISupportQtSQL-6.3.so.6.3.0 -lsqlite3 /usr/lib/x86_64-linux-gnu/libvtkGUISupportQtWebkit-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkViewsQt-6.3.so.6.3.0 -lproj /usr/lib/x86_64-linux-gnu/libvtkIOAMR-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so -lsz -ldl -lm /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so /usr/lib/x86_64-linux-gnu/libvtkIOEnSight-6.3.so.6.3.0 -lnetcdf_c++ -lnetcdf /usr/lib/x86_64-linux-gnu/libvtkIOExport-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingGL2PS-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingContextOpenGL-6.3.so.6.3.0 -lgl2ps /usr/lib/x86_64-linux-gnu/libvtkIOFFMPEG-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOMovie-6.3.so.6.3.0 -ltheoraenc -ltheoradec -logg /usr/lib/x86_64-linux-gnu/libvtkIOGDAL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOGeoJSON-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOImport-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOInfovis-6.3.so.6.3.0 -lxml2 /usr/lib/x86_64-linux-gnu/libvtkIOMINC-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOMPIImage-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOMPIParallel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOParallel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIONetCDF-6.3.so.6.3.0 -ljsoncpp /usr/lib/x86_64-linux-gnu/libvtkIOMySQL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOODBC-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOPLY-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOParallelExodus-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOParallelLSDyna-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOParallelNetCDF-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOParallelXML-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOPostgreSQL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOVPIC-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkVPIC-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOVideo-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOXdmf2-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkxdmf2-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingMath-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingMorphological-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingStatistics-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingStencil-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkInteractionImage-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkLocalExample-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkParallelMPI4Py-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingExternal-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingFreeTypeFontConfig-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingImage-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingLOD-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingMatplotlib-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingParallel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingParallelLIC-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingQt-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingVolumeAMR-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingVolumeOpenGL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkTestingGenericBridge-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkTestingIOSQL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkTestingRendering-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkViewsContext2D-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkViewsGeovis-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkWrappingJava-6.3.so.6.3.0 /usr/local/lib/x86_64-linux-gnu/libopencv_calib3d.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_features2d.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_flann.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_highgui.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_photo.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_video.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_videoio.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_imgproc.so.3.4.1 /usr/local/lib/x86_64-linux-gnu/libopencv_core.so.3.4.1 -lpcl_common -lpcl_octree -lpcl_io /usr/lib/x86_64-linux-gnu/libvtkFiltersFlowPaths-6.3.so.6.3.0 -ltheoraenc -ltheoradec -logg /usr/lib/x86_64-linux-gnu/libvtkIOExodus-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkexoIIc-6.3.so.6.3.0 -lnetcdf_c++ -lnetcdf /usr/lib/x86_64-linux-gnu/libvtkIOLSDyna-6.3.so.6.3.0 -lxml2 /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so -lsz -ldl -lm /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so /usr/lib/x86_64-linux-gnu/libvtkWrappingPython27Core-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkPythonInterpreter-6.3.so.6.3.0 -lpython2.7 /usr/lib/x86_64-linux-gnu/libvtkFiltersParallel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkParallelMPI-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingLIC-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersTexture-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkGUISupportQt-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.9.5 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.9.5 /usr/lib/x86_64-linux-gnu/libvtkFiltersAMR-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkParallelCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOLegacy-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingOpenGL-6.3.so.6.3.0 -lGLU -lSM -lICE -lX11 -lXext -lXt /usr/lib/x86_64-linux-gnu/libvtkIOSQL-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkViewsInfovis-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkChartsCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingContext2D-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersImaging-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingLabel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkGeovisCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOXML-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOGeometry-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOXMLParser-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkInfovisLayout-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkInfovisBoostGraphAlgorithms-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkInfovisCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkViewsCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkInteractionWidgets-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersHybrid-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingGeneral-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingSources-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersModeling-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkInteractionStyle-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingHybrid-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkDICOMParser-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkIOCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkmetaio-6.3.so.6.3.0 -lz /usr/lib/x86_64-linux-gnu/libvtkRenderingAnnotation-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingFreeType-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkftgl-6.3.so.6.3.0 -lfreetype -lGL /usr/lib/x86_64-linux-gnu/libvtkImagingColor-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingVolume-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkRenderingCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonColor-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersExtraction-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersStatistics-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingFourier-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkImagingCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkalglib-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersGeometry-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersSources-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersGeneral-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkFiltersCore-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonExecutionModel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonComputationalGeometry-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonDataModel-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonMisc-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonTransforms-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonMath-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtkCommonSystem-6.3.so.6.3.0 /usr/lib/x86_64-linux-gnu/libvtksys-6.3.so.6.3.0 -ldl -lproj /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.3.so.6.3.0 && :
CMakeFiles/joinMap.dir/src/joinMap.cpp.o:在函数‘void pcl::visualization::PCLVisualizer::convertPointCloudToVTKPolyData<pcl::PointXYZRGB>(pcl::visualization::PointCloudGeometryHandler<pcl::PointXYZRGB> const&, vtkSmartPointer<vtkPolyData>&, vtkSmartPointer<vtkIdTypeArray>&)’中:
joinMap.cpp:(.text._ZN3pcl13visualization13PCLVisualizer30convertPointCloudToVTKPolyDataINS_11PointXYZRGBEEEvRKNS0_25PointCloudGeometryHandlerIT_EER15vtkSmartPointerI11vtkPolyDataERS9_I14vtkIdTypeArrayE[_ZN3pcl13visualization13PCLVisualizer30convertPointCloudToVTKPolyDataINS_11PointXYZRGBEEEvRKNS0_25PointCloudGeometryHandlerIT_EER15vtkSmartPointerI11vtkPolyDataERS9_I14vtkIdTypeArrayE]+0xce):对‘pcl::visualization::PCLVisualizer::updateCells(vtkSmartPointer<vtkIdTypeArray>&, vtkSmartPointer<vtkIdTypeArray>&, long long)’未定义的引用
joinMap.cpp:(.text._ZN3pcl13visualization13PCLVisualizer30convertPointCloudToVTKPolyDataINS_11PointXYZRGBEEEvRKNS0_25PointCloudGeometryHandlerIT_EER15vtkSmartPointerI11vtkPolyDataERS9_I14vtkIdTypeArrayE[_ZN3pcl13visualization13PCLVisualizer30convertPointCloudToVTKPolyDataINS_11PointXYZRGBEEEvRKNS0_25PointCloudGeometryHandlerIT_EER15vtkSmartPointerI11vtkPolyDataERS9_I14vtkIdTypeArrayE]+0x127):对‘pcl::visualization::PCLVisualizer::allocVtkPolyData(vtkSmartPointer<vtkPolyData>&)’未定义的引用
CMakeFiles/joinMap.dir/src/joinMap.cpp.o:在函数‘bool pcl::visualization::PCLVisualizer::fromHandlersToScreen<pcl::PointXYZRGB>(pcl::visualization::PointCloudGeometryHandler<pcl::PointXYZRGB> const&, pcl::visualization::PointCloudColorHandler<pcl::PointXYZRGB> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&)’中:
joinMap.cpp:(.text._ZN3pcl13visualization13PCLVisualizer20fromHandlersToScreenINS_11PointXYZRGBEEEbRKNS0_25PointCloudGeometryHandlerIT_EERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiRKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEERKNSL_10QuaternionIfLi0EEE[_ZN3pcl13visualization13PCLVisualizer20fromHandlersToScreenINS_11PointXYZRGBEEEbRKNS0_25PointCloudGeometryHandlerIT_EERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiRKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEERKNSL_10QuaternionIfLi0EEE]+0x181):对‘pcl::visualization::PCLVisualizer::createActorFromVTKDataSet(vtkSmartPointer<vtkDataSet> const&, vtkSmartPointer<vtkLODActor>&, bool)’未定义的引用
joinMap.cpp:(.text._ZN3pcl13visualization13PCLVisualizer20fromHandlersToScreenINS_11PointXYZRGBEEEbRKNS0_25PointCloudGeometryHandlerIT_EERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiRKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEERKNSL_10QuaternionIfLi0EEE[_ZN3pcl13visualization13PCLVisualizer20fromHandlersToScreenINS_11PointXYZRGBEEEbRKNS0_25PointCloudGeometryHandlerIT_EERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiRKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEERKNSL_10QuaternionIfLi0EEE]+0x21d):对‘pcl::visualization::PCLVisualizer::addActorToRenderer(vtkSmartPointer<vtkProp> const&, int)’未定义的引用
joinMap.cpp:(.text._ZN3pcl13visualization13PCLVisualizer20fromHandlersToScreenINS_11PointXYZRGBEEEbRKNS0_25PointCloudGeometryHandlerIT_EERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiRKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEERKNSL_10QuaternionIfLi0EEE[_ZN3pcl13visualization13PCLVisualizer20fromHandlersToScreenINS_11PointXYZRGBEEEbRKNS0_25PointCloudGeometryHandlerIT_EERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiRKN5Eigen6MatrixIfLi4ELi1ELi0ELi4ELi1EEERKNSL_10QuaternionIfLi0EEE]+0x630):对‘pcl::visualization::PCLVisualizer::convertToVtkMatrix(Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, vtkSmartPointer<vtkMatrix4x4>&)’未定义的引用
CMakeFiles/joinMap.dir/src/joinMap.cpp.o:在函数‘bool pcl::visualization::PCLVisualizer::addPointCloud<pcl::PointXYZRGB>(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr const&, pcl::visualization::PointCloudColorHandler<pcl::PointXYZRGB> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)’中:
joinMap.cpp:(.text._ZN3pcl13visualization13PCLVisualizer13addPointCloudINS_11PointXYZRGBEEEbRKNS_10PointCloudIT_E8ConstPtrERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi[_ZN3pcl13visualization13PCLVisualizer13addPointCloudINS_11PointXYZRGBEEEbRKNS_10PointCloudIT_E8ConstPtrERKNS0_22PointCloudColorHandlerIS5_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi]+0x1c1):对‘pcl::visualization::PointCloudGeometryHandlerXYZ<pcl::PointXYZRGB>::PointCloudGeometryHandlerXYZ(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGB> const> const&)’未定义的引用
CMakeFiles/joinMap.dir/src/joinMap.cpp.o:在函数‘main’中:
joinMap.cpp:(.text.startup+0xf3e):对‘pcl::visualization::PCLVisualizer::PCLVisualizer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)’未定义的引用
joinMap.cpp:(.text.startup+0xfab):对‘pcl::visualization::PCLVisualizer::setBackgroundColor(double const&, double const&, double const&, int)’未定义的引用
joinMap.cpp:(.text.startup+0x1122):对‘pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties(int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)’未定义的引用
joinMap.cpp:(.text.startup+0x1145):对‘pcl::visualization::PCLVisualizer::initCameraParameters()’未定义的引用
joinMap.cpp:(.text.startup+0x130f):对‘pcl::visualization::PCLVisualizer::wasStopped() const’未定义的引用
joinMap.cpp:(.text.startup+0x132b):对‘pcl::visualization::PCLVisualizer::spinOnce(int, bool)’未定义的引用
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
2 解决方法
- 好久就找到一个解决方法,还不完全消除错误,但是可以生成可执行文件,且正常运行,故作此记录
- 未修改的的CMakeLists.txt文件为:
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} )
add_executable( joinMap joinMap.cpp )
target_link_libraries( joinMap ${OpenCV_LIBS} ${PCL_LIBRARIES} )
- 修改过的CMakeLists.txt文件可以使用的:
cmake_minimum_required( VERSION 2.8 )
project( joinMap )
set( CMAKE_BUILD_TYPE Release )
set( CMAKE_CXX_STANDARD 14 )#or 4
# opencv
find_package( OpenCV 3 REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
# eigen
include_directories("/usr/include/eigen3")
# pcl
#find_package( PCL REQUIRED COMPONENT common io)
find_package( PCL 1.8 REQUIRED)
set(PCL_INCLUDE_DIRS /usr/include/pcl-1.8) #指定pcl1.8路径
include_directories( ${PCL_INCLUDE_DIRS} )
add_definitions( ${PCL_DEFINITIONS} )
add_executable( joinMap src/joinMap.cpp )
target_link_libraries( joinMap ${OpenCV_LIBS} ${PCL_LIBRARIES} )
- 注意首先是第一开始使用的
find_package( PCL REQUIRED COMPONENT common io)
,会报这个错误提示,将其改成
find_package( PCL 1.8 REQUIRED)
set(PCL_INCLUDE_DIRS /usr/include/pcl-1.8) #指定pcl1.8路径
这两句,尝试编译
- 如果未成功,将将C++改成14,即添加
set( CMAKE_CXX_STANDARD 14 )#or 4
,后面我确实11和14都可以,但是先改成14,之后可以尝试11
- 如果还未成功,如果有
set( CMAKE_BUILD_TYPE Release )
,删去
- 虽然但是编译的时候仍然会有报警告,但不影响可执行文件的生成使用,类似于
CMake Warning (dev) at /home/bupo/CLion-2022.1.2/clion-2022.1.2/bin/cmake/linux/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (eigen) does
not match the name of the calling package (PCL). This can lead to problems
in calling code that expects `find_package` result variables (e.g.,
`_FOUND`) to follow a certain pattern.
3 参考文献
- 无法链接PCL库undefined reference to `pcl::PCLBase****