MacOS的VScode如何正常运行PCL库

问题背景

在MacOS上安装了VScode,在VScode编译完成了“helloworld.cpp“的基础c++代码运行。现希望在vscode上能够顺利运行PCL库的相关代码。
运行PCL相关代码时,始终编译报错。

相关情况

以下是c_cpp_properties.json文件:


    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "/opt/homebrew/Cellar/**",
                "/opt/homebrew/include/",
                "/opt/homebrew/Cellar/pcl/1.12.1_5/include/",
                "/opt/homebrew/Cellar/pcl/1.12.1_5/include/pcl-1.12",
                "/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3",
                "/opt/homebrew/Cellar/vtk/9.2.2/include/",
                "/opt/homebrew/Cellar/boost/1.80.0/include/",
                "/opt/homebrew/Cellar/vtk/9.2.2/include/vtk-9.2",
                "/opt/homebrew/Cellar/eigen/3.4.0_1/include/"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}

以下是task.json文件

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ 生成活动文件",
            "command": "/usr/bin/clang++",
            "args": [
                "-g",
                "${workspaceFolder}/${fileBasename}",
                "-I",
                "/opt/homebrew/Cellar/pcl/1.12.1_5/include/pcl-1.12",
                "-I",
                "/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3",
                "-I",
                "/opt/homebrew/Cellar/vtk/9.2.2/include/",
                "-I",
                "/opt/homebrew/Cellar/boost/1.80.0/include/",
                "-I",
                "/opt/homebrew/Cellar/qhull/include/qhull",
                "-I",
                "/opt/homebrew/include/flann",
                "-L",
                "/opt/homebrew/Cellar/pcl/1.12.1_5/lib/",
                "-L",
                "/opt/homebrew/Cellar/vtk/9.2.2/lib/",
                "-L",
                "/opt/homebrew/Cellar/boost/1.80.0/lib/",
                "-L",
                "/opt/homebrew/lib/",
                "-L",
                "/opt/homebrew/Cellar/qhull/lib/",
                "-L",
                "/opt/homebrew/Cellar/flann/1.9.1_6/lib/",
                "-L",
                "/usr/lib/",
                "-o",
                "${workspaceFolder}/${fileBasenameNoExtension}.out"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        },
    ],
    "version": "2.0.0"
}

以下是简单的PCL的c++代码

#include 
#include 
#include 
using namespace std;

int
main(int argc, char** argv)
{
    // --------------------加载源点云-----------------------
    pcl::PointCloud::Ptr source(new pcl::PointCloud);
    pcl::io::loadPCDFile("source.pcd", *source);
    cout << "从源点云中读取 " << source->size() << " 个点" << endl;
    return (0);
}

运行结果及详细报错内容

运行后报错

img

通过“转到定义”,发现定义的.h文件中也存在大量报错,如下图:

img

归结原因应该是头文件和库链接没到位
请问一下如何能够正确设置.json文件,以达到调试以及顺利运行的目的