how do i use PCL library after installing with vcpkg?

1.2k Views Asked by At

Its my first time using vcpkg to install PCL library. After successfully installing using

.\vcpkg install pcl

i tried using vcpkg integrate install to link it but to no avail. I am using VS code and a MinGW gcc compiler under C:/MingGW/bin/gcc.exe

#include <pcl/point_types.h>

returns an error #include errors detected. cannot open source file. I dont understand using cmake files to compile, can someone help me out thanks!

1

There are 1 best solutions below

0
On

I had the same issue once, but it was totally my fault. There are more than one options on vcpkg for downloading pcl. You can get x64 or x86 for example. Your project should be compiled with the corresponding settings. If it is not the problem, then here is an example for including pcl in CMakeList.

cmake_minimum_required(VERSION 3.0)
set(DEMO_NAME lidar_lvx_sample)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(${DEMO_NAME} main.cpp lvx_file.cpp)
target_link_libraries(${DEMO_NAME}
    PRIVATE
    ${PROJECT_NAME}_static PUBLIC ${PCL_LIBRARIES}
    )

Based on this, you can make the changes in your CMakeList