点云分割代码报错
https://adamshan.blog.csdn.net/article/details/84569000?spm=1001.2014.3001.5502?%ra=card
我已经安装了pcl,并且在pcl/point_cloud.h找到了point_traits.h
为什么仍然不能编译通过?
In file included from /home/vickytwan/catkin_ws/src/plane_fit_ground_filter/include/plane_ground_filter_core.h:12,
from /home/vickytwan/catkin_ws/src/plane_fit_ground_filter/src/plane_ground_filter_core.cpp:1:
/opt/ros/noetic/include/pcl_ros/point_cloud.h:6:10: fatal error: pcl/point_traits.h: 没有那个文件或目录
6 | #include
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [plane_fit_ground_filter/CMakeFiles/plane_ground_filter_node.dir/build.make:76:plane_fit_ground_filter/CMakeFiles/plane_ground_filter_node.dir/src/plane_ground_filter_core.cpp.o] 错误 1
make[2]: *** 正在等待未完成的任务....
该回答引用GPTᴼᴾᴱᴺᴬᴵ
根据你提供的信息,看起来编译器无法找到pcl/point_traits.h头文件。这可能是由于PCL没有正确地安装或配置所导致的。
请确保已正确安装了PCL,并使用了正确的CMake设置。如果您使用的是ROS,则可以通过以下命令来安装PCL:
sudo apt-get install ros-noetic-pcl-ros
如果已经安装了PCL并且仍然无法找到该头文件,请检查PCL是否在系统路径中。您可以通过以下命令检查:
echo $LD_LIBRARY_PATH
如果PCL未包含在其中,请在bashrc文件中添加PCL的路径:
export LD_LIBRARY_PATH=/path/to/pcl:$LD_LIBRARY_PATH
另外,请确保CMakeList.txt文件中包含PCL的链接信息。在你的CMakeList.txt中添加以下行:
find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
希望这能够帮助您解决问题。