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 <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/project_inliers.h>


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

	pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_projected(new pcl::PointCloud<pcl::PointXYZ>);

	// 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<pcl::PointXYZ> 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检查-选择否
在这里插入图片描述如果上述方法没解决,请试着修改model_type.h程序
在这里插入图片描述

`/*
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));
}

第二个问题

无法定位程序输入点、、、、、于动态链接库.exe
在这里插入图片描述将属性-c/c+±预处理器-预处理器定义 添加一行 PCL_NO_PRECOMPILE
在这里插入图片描述

第三个问题

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

运行成功

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CoomCon

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值