赞
踩
我是刚开始接触SLAM和VScode,学到CH3的时候,搞不懂如何去配置这些文件,去看了B站上的一个up主的视频结合自身的需求来写的。
launch.json:帮助设置调试(debug)的参数信息
1点击创建launch.json 2点击创建配置 3选择C/C++(gdb)启动
qidong
这里需要改的就是:"program": "${workspaceFolder}/build/main",//改成自己CMake..和make的可执行文件
- {
- // 使用 IntelliSense 了解相关属性。
- // 悬停以查看现有属性的描述。
- // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
-
- {
- "name": "(gdb) 启动",
- "type": "cppdbg",
- "request": "launch",
- "program": "${workspaceFolder}/build/main",//改成自己的可执行文件
- "args": [],
- "stopAtEntry": false,
- "cwd": "${workspaceFolder}",
- "environment": [],
- "externalConsole": false,
- "MIMode": "gdb",
- "setupCommands": [
- {
- "description": "为 gdb 启用整齐打印",
- "text": "-enable-pretty-printing",
- "ignoreFailures": true
- },
- {
- "description": "将反汇编风格设置为 Intel",
- "text": "-gdb-set disassembly-flavor intel",
- "ignoreFailures": true
- }
- ],
- "preLaunchTask": "Build", //调用tasks中的Build
- "miDebuggerPath": "/usr/bin/gdb"
- }
-
-
- ]
- }
tasks.json:CMake .. 和make
Ctrl + shift + B随意选择一个,把下面的代码粘贴到tasks.json:实现自动编译。
- {
- "version": "2.0.0",
- "options": {
- "cwd": "${workspaceFolder}/build"
- },
- "tasks": [
- {
- "type": "shell",
- "label": "cmake",
- "command": "cmake",
- "args": [
- ".."
- ]
- },
- {
- "label": "make",
- "group": {
- "kind": "build",
- "isDefault": true
- },
- "command": "make",
- "args": [
- ]
- },
- {
- "label": "Build",
- "dependsOrder": "sequence", // 按列出的顺序执行任务依赖项
- "dependsOn":[
- "cmake",
- "make"
- ]
- }
- ]
-
- }
c_cpp_properties.json:编译器路径和智能代码提示 配置文件
如果头文件找不到加上就可以了一般自动生成不需要改
- {
- "configurations": [
- {
- "name": "Linux",
- "includePath": [
- "${workspaceFolder}/**",
- "/usr/include/eigen3/",
- "/usr/include/**",
- "/usr/local/include/**"
-
-
- ],
- "defines": [],
- "compilerPath": "/usr/bin/gcc",
- "cStandard": "c17",
- "cppStandard": "gnu++14",
- "intelliSenseMode": "linux-gcc-x64"
- }
- ],
- "version": 4
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。