【问题标题】:point cloud library not working in VS 2019 but does work in VS 2017点云库在 VS 2019 中不起作用,但在 VS 2017 中起作用
【发布时间】:2020-10-12 01:17:49
【问题描述】:

我已经用 vcpkg 安装了点云库。这也是我第一次使用 vcpkg,但经过一些重新安装后,我终于通过使用 '.\vcpkg install pcl:windows-x64' 命令安装了 pointcloud 库。但仅适用于visual studio 2017 ......而我想要包含它的项目完全在VS2019中完成。它确实识别库并链接它们,但它给出了关于 boost 库中某些文件的各种错误?我真的很想让库与 VS2019 一起工作,但我真的找不到解决方案。

代码示例:

    #include <iostream>
    #include <pcl/io/pcd_io.h>
    #include <pcl/io/boost.h>
    #include <pcl/point_types.h>

    int main(int argc, char** argv)

{

pcl::PointCloud<pcl::PointXYZ> cloud;
    // Fill in the cloud data
    cloud.width = 5;
    cloud.height = 1;
    cloud.is_dense = false;
    cloud.points.resize(cloud.width * cloud.height);

    for (std::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);
    }

    pcl::io::savePCDFileASCII("test_pcd.pcd", cloud);
    std::cerr << "Saved " << cloud.points.size() << " data points to test_pcd.pcd." << std::endl;

    for (std::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;

    return (0);
}

所有错误的代码都是 C2116 或 C2773,下面是几个示例。

错误:

错误 C2116 'boost::interprocess::winapi::CreateDirectoryA':函数参数列表在声明 Project1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\fileapi 之间不匹配.h

错误 C2116 'boost::interprocess::winapi::CreateFileA':函数参数列表在声明 Project1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\fileapi 之间不匹配.h

错误 C2733 'CreateDirectoryA':您无法使用“C”链接 Project1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\fileapi.h 重载函数

【问题讨论】:

    标签: c++ visual-studio boost point-cloud-library


    【解决方案1】:

    找到了让 PCL 库在 VS2019 中工作的解决方案,在配置中,您需要将构建工具从 V142(2019) 设置为 V141(2017)。

    【讨论】:

      猜你喜欢
      • 2021-07-22
      • 2018-02-14
      • 1970-01-01
      • 2018-07-26
      • 1970-01-01
      • 2018-07-08
      • 1970-01-01
      • 1970-01-01
      • 2017-12-21
      相关资源
      最近更新 更多