点云库在VS 2019中不起作用,但在VS 2017中可以工作 [英] point cloud library not working in VS 2019 but does work in VS 2017

查看:73
本文介绍了点云库在VS 2019中不起作用,但在VS 2017中可以工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用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.width = 5;cloud.height = 1;cloud.is_dense = false;cloud.points.resize(cloud.width * cloud.height);为(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",云);std :: cerr<<已保存"<<cloud.points.size()<<"数据指向test_pcd.pcd."<<std :: endl;为(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;返回(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

解决方案

找到了使PCL库在VS2019中运行的解决方案,在配置中,您需要将构建工具从V142(2019)设置为V141(2017)./p>

I've installed the pointcloud library with vcpkg. It's also the first time I'm working with vcpkg but and after some reinstalls I finally got the pointcloud library working by installing it with the '.\vcpkg install pcl:windows-x64' command. But only for visual studio 2017... And the project I want to include it in is entirely done in VS2019. It does recognize the libraries and links them, but it gives all sorts of errors about certain files in the boost libraries? I really want to get the library to work with VS2019, but I can't really find a solution.

code example:

    #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);
}

All errors have the code C2116 or C2773, below a few examples.

errors:

Error C2116 'boost::interprocess::winapi::CreateDirectoryA': function parameter lists do not match between declarations Project1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\fileapi.h

Error C2116 'boost::interprocess::winapi::CreateFileA': function parameter lists do not match between declarations Project1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\fileapi.h

Error C2733 'CreateDirectoryA': you cannot overload a function with 'C' linkage Project1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\fileapi.h

解决方案

Found the solution to get the PCL lib working in VS2019, in configuration you need to set the build tools from V142(2019) to V141(2017).

这篇关于点云库在VS 2019中不起作用,但在VS 2017中可以工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆