vscode在win10 / linux下的.vscode資料夾的配置 (c++/c)
阿新 • • 發佈:2018-12-18
系統方面配置自行查詢
linux:
launch.json
{ // 使用 IntelliSense 瞭解相關屬性。 // 懸停以檢視現有屬性的描述。 // 欲瞭解更多資訊,請訪問: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot}/${fileBasenameNoExtension}.out", "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" } ] }
tasks.json
{ "version": "2.0.0", "tasks": [ {"label": "build",//任務名,和lanuch.json中的"preLaunchTask":"build"一致 "type": "shell", "command": "g++", "args":["-g","${workspaceRoot}/${fileBasenameNoExtension}.cpp","-o","${fileBasenameNoExtension}.out"],//要編譯的檔案mian_test.cpp,${workspaceRoot}表示vscode所開啟的工作目錄 "problemMatcher": { "owner":"cpp", "fileLocation":["relative","${workspaceRoot}"], "pattern": { "regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$", "file": 1, "line":2, "column":3, "severity": 4, "location": 2, "message": 5 } } } ] }
win10:
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "preLaunchTask": "build", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "C:/mingw/bin/gdb.exe", // 這裡修改GDB路徑為安裝的mingw64的bin下的gdb.exe路徑 "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }]
tasks.json
{ "version": "2.0.0", "tasks": [ { "label": "build", "type": "shell", "group": { "kind": "build", "isDefault": true }, "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "windows": { "command": "g++", "args": [ "-ggdb", "\"${file}\"", "--std=c++11", "-o", "\"${fileDirname}\\${fileBasenameNoExtension}.exe\"" ] } } ] }