ubuntu系统catkin_make编译时error C4996: pcl::SAC_SAMPLE_SIZE

catkin_make编译时出现以下错误:

error C4996: 'pcl::SAC_SAMPLE_SIZE': This map is deprecated and is kept only to prevent breaking 
existing user code. Starting from PCL 1.8.0 model sample size is a protected member of the 
SampleConsensusModel class.

ubuntu系统catkin_make编译时error C4996: pcl::SAC_SAMPLE_SIZE_第1张图片

解决办法

在终端输入

sudo gedit '/usr/include/pcl-1.8/pcl/sample_consensus/model_types.h' 

会打开如下图所示文件:
ubuntu系统catkin_make编译时error C4996: pcl::SAC_SAMPLE_SIZE_第2张图片

找到下面代码所处位置

namespace pcl
{
  const static std::map<pcl::SacModel, unsigned int>
      PCL_DEPRECATED("This map is deprecated and is kept only to prevent breaking "
      "existing user code. Starting from PCL 1.8.0 model sample size "
      "is a protected member of the SampleConsensusModel class")
  SAC_SAMPLE_SIZE (sample_size_pairs, sample_size_pairs + sizeof (sample_size_pairs) / sizeof (SampleSizeModel));
}

如下图所示进行修改

namespace pcl
{
  const static std::map<pcl::SacModel, unsigned int>
      //PCL_DEPRECATED("This map is deprecated and is kept only to prevent breaking "
      //"existing user code. Starting from PCL 1.8.0 model sample size "
      //"is a protected member of the SampleConsensusModel class")
  SAC_SAMPLE_SIZE (sample_size_pairs, sample_size_pairs + sizeof (sample_size_pairs) / sizeof (SampleSizeModel));
}

保存后退出,重新catkin_make。

你可能感兴趣的:(笔记,其他)