我已成功链接仅包含一个ReadPc.cpp文件的基本项目,显然是从Visual Studio 2010中的文件读取点云
抛出运行异常后,弹出窗口“R6010 abort()已被调用”显示
当我设置我的应用程序时,我遵循了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);
}

问题线好像是这个
如果(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模式。

10-04 21:58
查看更多