【C++17】gcc-9与pcl库的auto_ptr冲突的解决方法

报错提示:

/usr/include/c++/9/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
In file included from /media/crossview_slam/src/cross_view_slam-master/include/top_down_render/scan_renderer.h:10,
                 from /media/crossview_slam/src/cross_view_slam-master/src/scan_renderer.cpp:1:
/usr/include/pcl-1.8/pcl/visualization/cloud_viewer.h:202:14: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
  202 |         std::auto_ptr<CloudViewer_impl> impl_;

解决方法:
使用gedit将PCL库的/usr/include/pcl-1.8/pcl/visualization/cloud_viewer.h文件的Line 202

std::auto_ptr<CloudViewer_impl> impl_;

改为

std::shared_ptr<CloudViewer_impl> impl_;

修改保存后,重新编译即可。

猜你喜欢

转载自blog.csdn.net/weixin_56917387/article/details/128222259