Search code examples
c++point-cloud-libraryvcpkg

PCL not properly installed with vcpkg


I've installed the PCL with the vcpkg using ./vcpkg install pcl:x64-windows.
After a while I've noticed that concave_hull.h, convex_hull.h and qhull.h are not installed with the rest of the library.
Additional information of what I'm working with:

  • vcpkg tag (2020.11.01)
  • OS Windows 10
  • VS Community 16.8.3

For completion's sake I've included the code which lead me to this problem:

#include <pcl/surface/concave_hull.h>
#include <pcl/point_cloud.h>
int main()
{
    using point_cloud_colored = pcl::PointCloud<pcl::PointXYZRGB>;
    //plane is generated from somewhere else and is not important for this issue
    point_cloud_colored::Ptr plane = load_cloud_from_somewhere(); 
    point_cloud_colored::Ptr hull_cloud(new point_cloud_colored);
    pcl::ConcaveHull<point_cloud_colored> chull;
    chull.setInputCloud(plane);
    chull.setAlpha(0.1);
    chull.reconstruct(*hull_cloud);
}

This code produces the following error message:

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'pcl/surface/concave_hull.h': No such file or directory farrao_gui C:\Users\ ...\farrao\source\farrao_gui\farrao_gui.cpp 39

I've already tried to reinstall via vcpkg but with no success.
Is there a way to fix this problem?


Solution

  • After a while I solved the problem by switching to the reentrant qhull version following this guide: http://www.qhull.org/html/README_r.txt.

    You have to copy the concave_hull code into files (hpp, h and cpp) within your own project.

    Fix the headers and remove the #ifdef HAVE_QHULL in every file and add this chunk of code within your hpp file:

    extern "C"
    {
    #include <libqhull_r/qhull_ra.h>
    qhT qh_qh;
    qhT* qh = &qh_qh;
    }
    

    After that:

    • Replace every qh Makro with qh->
    • go through every qh_... function and add the qh pointer as the first parameter (if necessary)
    • go through every FOREACHvertex_i_ Makro and add qh as the first parameter

    This is probably not the best solution since this problem is well out of my league but the algorithm does generate results. It might also work with the convex algorithm (since it is also not included within the vcpkg installation).
    I hope this answer might be helpful to someone with a similar problem.