【问题标题】:PCL library basic project returns abort has been calledPCL 库基本项目返回 abort 已调用
【发布时间】:2014-08-05 16:09:42
【问题描述】:

我已成功链接我的基本项目,其中仅包含一个 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)

在调试模式下输出显示

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).

感谢任何建议

【问题讨论】:

    标签: c++ visual-studio-2010 point-cloud-library point-clouds


    【解决方案1】:

    在我的情况下,这是由于依赖项的配置和项目的配置不同。由于我的项目依赖项处于发布模式,因此通过将配置更改为发布模式来解决。

    【讨论】:

      【解决方案2】:

      我没有使用 PCL 库的经验,但 std::bad_alloc 意味着 new 失败。 “operator new 和 operator new[] 的标准定义在分配请求的存储空间失败时抛出的异常类型。” 来源:cplusplus

      可能您正在加载的文件太大,或者如果该加载请求继续内存,您没有可用的内存。

      您还可以尝试捕获异常并查看 ex.what() 对异常原因的建议。

      【讨论】:

        【解决方案3】:

        如果您使用 PCL 站点或 github 教程中的“kitchen.pcd”,那么您应该知道该文件的点是 . 您可以在写字板中打开“.pcd”文件并确保这一点。 如果是这样,请将类型“PointXYZ”更改为“PointXYZRGB”。 希望对您有所帮助!

        【讨论】:

        • 类型不是问题,因为 PCL 内部会处理这个问题。因此,例如,如果您希望输入 PointXYZRGB 而您收到的是 PointXYZ,则没有问题。 PCL 只是忽略它没有收到的字段并给出警告。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-31
        • 1970-01-01
        • 2016-03-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多