我已成功链接仅包含一个 ReadPc.cpp 文件的基本项目,显然是从 Visual Studio 2010 中的文件中读取点云 运行异常抛出后弹窗显示“R6010 abort() has been called” 当我设置我的应用程序时,我遵循了 this tutorial
这是我的代码
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
int
main (int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
std::cout << "bejzikl";
if (pcl::io::loadPCDFile<pcl::PointXYZ> ("kitchen.pcd", *cloud) == -1) //* load the file
{
PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
return (-1);
}
std::cout << "Loaded "
<< cloud->width * cloud->height
<< " data points from test_pcd.pcd with the following fields: "
<< std::endl;
for (size_t i = 0; i < cloud->points.size (); ++i)
std::cout << " " << cloud->points[i].x
<< " " << cloud->points[i].y
<< " " << cloud->points[i].z << std::endl;
return (0);
}
问题线好像是这一条 if (pcl::io::loadPCDFile ("kitchen.pcd", *cloud) == -1)
在 Debug模式下输出显示
First-chance exception at 0x7566812f in Meshes.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0030f36c..
Unhandled exception at 0x7566812f in Meshes.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0030f36c..
The program '[15424] Meshes.exe: Native' has exited with code -529697949 (0xe06d7363).
我很感激任何建议
最佳答案
在我的例子中,这是由于依赖项的配置和项目的配置不同。通过将配置更改为 Release模式来解决,因为我的项目依赖项处于 Release模式。
关于c++ - PCL 库基本项目返回 abort 已被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20923236/