vscode-C開發環境

安裝vscode套件

C++ 、CMake 、CMake Tools

製作launch.json

而launch.json可以呼叫task.json裡面的工作,只需要在preLaunchTask中指定,範例如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"-c",
"licenceplate_nvmultiurisrcbin.txt"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/iisi-ds63",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}

cmake tool 設定文件

https://code.visualstudio.com/docs/cpp/CMake-linux

https://github.com/microsoft/vscode-cmake-tools/tree/024d14df75d397a682da4a864eac420824e4ddba/docs

Author

Steven

Posted on

2023-07-05

Updated on

2025-06-02

Licensed under

Comments