point cloud library not working in VS 2019 but does work in VS 2017

Viewed 583

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

1 Answers

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

Related