PCL 出错:体系结构x86_64 @pcl的未定义符号

PCL make error: Undefined symbols for architecture x86_64 @pcl

本文关键字:@pcl 未定义 符号 出错 体系结构 x86 PCL      更新时间:2023-10-16

使用 cmake 没有错误 ..

按如下方式制作时发生错误:

Scanning dependencies of target environment
[ 25%] Building CXX object CMakeFiles/environment.dir/src/environment.cpp.o
[ 50%] Building CXX object CMakeFiles/environment.dir/src/render/render.cpp.o
[ 75%] Building CXX object CMakeFiles/environment.dir/src/processPointClouds.cpp.o
[100%] Linking CXX executable environment
Undefined symbols for architecture x86_64:
"pcl::visualization::createLine(Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&)", referenced from:
bool pcl::visualization::PCLVisualizer::addLine<pcl::PointXYZ, pcl::PointXYZ>(pcl::PointXYZ const&, pcl::PointXYZ const&, double, double, double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in render.cpp.o
"pcl::visualization::PCLVisualizer::removeShape(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
clearRays(boost::shared_ptr<pcl::visualization::PCLVisualizer>&) in render.cpp.o
"pcl::visualization::PCLVisualizer::updateCells(vtkSmartPointer<vtkIdTypeArray>&, vtkSmartPointer<vtkIdTypeArray>&, long long)", referenced from:
...
...
...
...
_main in environment.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [environment] Error 1
make[1]: *** [CMakeFiles/environment.dir/all] Error 2
make: *** [all] Error 2

这些清单.txt

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)    
add_definitions(-std=c++11)    
set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")    
project(playback)    
find_package(PCL 1.2 REQUIRED COMPONENTS common io)    
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
add_executable (environment src/environment.cpp src/render/render.cpp src/processPointClouds.cpp)
target_link_libraries (environment ${PCL_LIBRARIES})

OSmac catarina PCL 1.9 xcode

问题应该与cmakelist有关.txt例如库链接,但我没有任何想法来定位和修复它。

通过链接库解决:

find_package(PCL 1.3 REQUIRED COMPONENT common io VISUALIZATION)
target_link_libraries (environment ${PCL_LIBRARIES} ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES} ${PCL_VISUALIZATION_LIBRARIES})