c++ - PCL 库基本项目返回 abort 已被调用

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

我已成功链接仅包含一个 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/

相关文章:

c++ - 当期望 T 作为模板化参数时,make_tuple 将类型 T 作为 T&& 传递

c++ - 是否可以在一个 main.ui 文件中包含多个 .ui 文件?

c++ - std::result_of 应用于 const 重载方法

c++ - 临时对象存储在哪里?

c++ - 抑制从 const 方法打印的消息

c++ - CMake set_target_properties 和 include_directories

c++ - 我可以创建一个 auto_ptr 数组吗?

c++ - #include<线程>,错误无法打开源文件 "thread"

C++ 模板 - 没有可行的转换错误

c++ - 如何检测两个 3D 点云之间的差异?