【问题标题】:PCL make error: Undefined symbols for architecture x86_64 @pclPCL 出错:架构 x86_64 @pcl 的未定义符号
【发布时间】:2020-01-08 05:24:06
【问题描述】:

使用 cmake 没有错误 ..

make 时出现如下错误:

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

cmakelists.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})

操作系统 麦克卡塔琳娜 PCL 1.9 代码

问题应该和库链接之类的cmakelists.txt有关,但是我没有任何想法来定位和修复它。

【问题讨论】:

    标签: c++ point-cloud-library


    【解决方案1】:

    通过链接库解决:

    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})
    

    【讨论】:

      猜你喜欢
      • 2016-02-02
      • 1970-01-01
      • 2015-10-27
      • 2017-02-15
      • 1970-01-01
      • 1970-01-01
      • 2014-08-07
      • 2012-07-20
      • 1970-01-01
      相关资源
      最近更新 更多