VS2015+PCL1.8.1+Win10环境配置-----问题总结

基础环境配置都是比较简单的,请按照下面几篇博客完成配置
https://blog.csdn.net/uniqueyyc/article/details/79245009
https://blog.csdn.net/u013541523/article/details/84194207
https://blog.csdn.net/liukunrs/article/details/80216329
如果按照上述几篇博客配置成功,后面的就不需要看了。

确保上述配置无误,文件最起码是可以编译成功的。
下面是我使用的试验代码,也是摘自上面几篇博客中的代码。

#include "stdafx.h"
#include 
#include 
#include 
#include 
#include 
#include 
#include 


int main(int argc, char** argv)
{
	pcl::PointCloud::Ptr cloud(new pcl::PointCloud);

	pcl::PointCloud::Ptr cloud_projected(new pcl::PointCloud);

	// Fill in the cloud data
	cloud->width = 5;
	cloud->height = 1;
	cloud->points.resize(cloud->width * cloud->height);

	for (size_t i = 0; i < cloud->points.size(); ++i)
	{
		cloud->points[i].x = 1024 * rand() / (RAND_MAX + 1.0f);
		cloud->points[i].y = 1024 * rand() / (RAND_MAX + 1.0f);
		cloud->points[i].z = 1024 * rand() / (RAND_MAX + 1.0f);
	}

	std::cerr << "Cloud before projection: " << std::endl;
	for (size_t i = 0; i < cloud->points.size(); ++i)
		std::cerr << "    " << cloud->points[i].x << " "
		<< cloud->points[i].y << " "
		<< cloud->points[i].z << std::endl;

	// Create a set of planar coefficients with X=Y=0,Z=1
	pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients());
	coefficients->values.resize(4);
	coefficients->values[0] = coefficients->values[1] = 0;
	coefficients->values[2] = 1.0;
	coefficients->values[3] = 0;

	// Create the filtering object
	pcl::ProjectInliers proj;
	proj.setModelType(pcl::SACMODEL_PLANE);
	proj.setInputCloud(cloud);
	proj.setModelCoefficients(coefficients);
	proj.filter(*cloud_projected);

	std::cerr << "Cloud after projection: " << std::endl;

	for (size_t i = 0; i < cloud_projected->points.size(); ++i)
		std::cerr << "    " << cloud_projected->points[i].x << " "
		<< cloud_projected->points[i].y << " "
		<< cloud_projected->points[i].z << std::endl;

	system("pause");
	return (0);
}

第一个问题

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 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 pcltest d:\program files\pcl 1.8.1\include\pcl-1.8\pcl\sample_consensus\model_types.h 99
在这里插入图片描述属性-c/c+±常规-sdl检查-选择否
VS2015+PCL1.8.1+Win10环境配置-----问题总结_第1张图片如果上述方法没解决,请试着修改model_type.h程序
VS2015+PCL1.8.1+Win10环境配置-----问题总结_第2张图片

`/*
namespace pcl
{
  const static std::map
  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_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));
}

第二个问题

无法定位程序输入点、、、、、于动态链接库.exe
VS2015+PCL1.8.1+Win10环境配置-----问题总结_第3张图片将属性-c/c+±预处理器-预处理器定义 添加一行 PCL_NO_PRECOMPILE
VS2015+PCL1.8.1+Win10环境配置-----问题总结_第4张图片

第三个问题

有时候会遇到一个问题 先前遇到过但是没法复现了
调试输出中一般会出现下面几个类似的字符 需要#define _CRT_SECURE_NO_WARNINGS之类的
针对这个问题,还是在预处理器定义中,添加一行_CRT_SECURE_NO_WARNINGS即可

运行成功

VS2015+PCL1.8.1+Win10环境配置-----问题总结_第5张图片

你可能感兴趣的:(C++)