Can‘t Compile project with PCL

报错:

In file included from /usr/include/vtk/vtkAtomicTypes.h:18:0,
                 from /usr/include/vtk/vtkObjectBase.h:46,
                 from /usr/include/vtk/vtkSmartPointerBase.h:27,
                 from /usr/include/vtk/vtkSmartPointer.h:23,
                 from /usr/include/pcl-1.8/pcl/visualization/point_cloud_geometry_handlers.h:48,
                 from /usr/include/pcl-1.8/pcl/visualization/point_cloud_handlers.h:41,
                 from /usr/include/pcl-1.8/pcl/visualization/common/actor_map.h:40,
                 from /usr/include/pcl-1.8/pcl/visualization/pcl_visualizer.h:48,
                 from /usr/include/pcl-1.8/pcl/visualization/cloud_viewer.h:39,
                 from /home/usr/my_code/pclviewer.h:3,
                 from /home/usr/my_code/stereo.h:8,
                 from /home/usr/my_code/stereo.cpp:1:
/usr/include/vtk/vtkAtomic.h:358:11: error: reference to 'detail' is ambiguous
   typedef detail::AtomicOps Impl;
           ^~~~~~
/usr/include/vtk/vtkAtomic.h:82:11: note: candidates are: namespace detail { }
 namespace detail
           ^~~~~~
In file included from /usr/local/include/opencv2/core/base.hpp:56:0,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:48,
                 from /home/usr/my_code/stereo.h:4,
                 from /home/usr/my_code/stereo.cpp:1:
/usr/local/include/opencv2/core/cvstd.hpp:165:11: note:                 namespace cv::detail { }
 namespace detail
           ^~~~~~
In file included from /usr/include/vtk/vtkAtomicTypes.h:18:0,
                 from /usr/include/vtk/vtkObjectBase.h:46,
                 from /usr/include/vtk/vtkSmartPointerBase.h:27,
                 from /usr/include/vtk/vtkSmartPointer.h:23,
                 from /usr/include/pcl-1.8/pcl/visualization/point_cloud_geometry_handlers.h:48,
                 from /usr/include/pcl-1.8/pcl/visualization/point_cloud_handlers.h:41,
                 from /usr/include/pcl-1.8/pcl/visualization/common/actor_map.h:40,
                 from /usr/include/pcl-1.8/pcl/visualization/pcl_visualizer.h:48,
                 from /usr/include/pcl-1.8/pcl/visualization/cloud_viewer.h:39,
                 from /home/usr/my_code/pclviewer.h:3,
                 from /home/usr/my_code/stereo.h:8,
                 from /home/usr/my_code/stereo.cpp:1:
/usr/include/vtk/vtkAtomic.h:434:12: error: 'Impl' has not been declared
...

解决办法:
头文件里绝对不要使用:using namespace cv; 删去改代码,把所使用这个命名空间的加上cv::。

using namespace cv;
using namespace std;都要慎用,否则会毁掉整个工程。

你可能感兴趣的:(SLAM,Ubuntu)