PCL vscode调试运行配置

1、c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/local/include/pcl-1.9",
                "/usr/include/eigen3",
                "/usr/include/ni",
                "/usr/include/vtk-6.3",
                "/usr/src/glibc/glibc-2.27",
                "/usr/include/pcl-1.9"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "${default}",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

2、tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [ // 可以有多个参数
        {
            "label": "build", // 编译任务名
            "type": "shell", // 编译任务的类型,通常为shell/process类型
            "command": "g++", // 编译命令
            "args": [
                "-g",
                "${workspaceFolder}/${fileB

### 配置和使用 PCL 点云库于 VSCode #### 安装依赖项与环境准备 为了在 Visual Studio Code (VSCode) 中成功配置并使用 Point Cloud Library (PCL),需先安装必要的依赖项。对于 Windows 用户来说,可以从指定链接下载预编译版本的 PCL 1.9.1[^2]。 #### 设置开发环境 完成上述准备工作之后,在本地计算机上创建一个新的工作区用于存放项目文件以及后续操作所需资源。确保已正确设置了系统的 `PATH` 变量以便能够访问到 PCL 的二进制文件路径。 #### 编写 CMakeLists.txt 文件 CMake 是一种跨平台构建工具,它可以帮助简化复杂项目的管理过程。下面是一个简单的例子来展示如何编写适用于包含 PCL 库支持的应用程序所需的 `CMakeLists.txt` 文件: ```cmake cmake_minimum_required(VERSION 3.10) project(PointCloudExample VERSION 1.0 LANGUAGES CXX) find_package(PCL 1.8 REQUIRED COMPONENTS common io visualization) add_executable(${PROJECT_NAME} main.cpp) target_link_libraries (${PROJECT_NAME} ${PCL_LIBRARIES}) ``` 此脚本会查找系统中存在的 PCL 版本,并将其加入到目标可执行文件当中去[^1]。 #### 创建 launch.json 和 tasks.json 文件 为了让调试更加方便快捷,可以在 `.vscode/launch.json` 中定义启动配置;同时通过编辑 `.vscode/tasks.json` 来设定编译命令。以下是两个 JSON 文件的一个基本模板: `.vscode/launch.json` ```json { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "Build Project" } ] } ``` `.vscode/tasks.json` ```json { "tasks": [ { "label": "Build Project", "command": "cmake --build . --config Debug", "group": { "kind": "build", "isDefault": true }, "problemMatcher": ["$gcc"], "detail": "Generated task to build the project using cmake." } ], "version": "2.0.0" } ``` 以上设置允许一键点击 F5 即可在终端内自动运行完整的编译流程直至最终应用程序被执行起来。 #### 测试 PCL 功能 最后一步就是验证整个集成是否正常运作了。可以尝试编写一段简单代码读取一个点云数据集并显示出来作为初步检验手段之一。这里给出了一段 Python 脚本来实现这一目的: ```python import pcl cloud = pcl.load_XYZRGB('example.pcd') visualizer = cloud.make_openni_viewer() visualizer.run_on_init(lambda v: None) visualizer.spin() ```
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小小蜗牛,大大梦想

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值