vscode c語言的環(huán)境配置
完整教程請(qǐng)查看該教程:https://blog.csdn.net/qq_43041976/article/details/100542557
使用MinGW-W64 GCC-8.1.0編譯器默認(rèn)安裝目錄的配置文件
MinGW-W64 GCC下載地址:https:///projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe
離線下載地址:https:///projects/mingw-w64/files/mingw-w64/mingw-w64-release/
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch", // 配置名稱,將會(huì)在啟動(dòng)配置的下拉菜單中顯示
"type": "cppdbg", // 配置類型,這里只能為cppdbg
"request": "launch", // 請(qǐng)求配置類型,可以為launch(啟動(dòng))或attach(附加)
"program": "${workspaceFolder}/${fileBasenameNoExtension}.exe", // 將要進(jìn)行調(diào)試的程序的路徑
"args": [], // 程序調(diào)試時(shí)傳遞給程序的命令行參數(shù),一般設(shè)為空即可
"stopAtEntry": false, // 設(shè)為true時(shí)程序?qū)和T诔绦蛉肟谔帲话阍O(shè)置為false
"cwd": "${workspaceFolder}", // 調(diào)試程序時(shí)的工作目錄,一般為${workspaceRoot}即代碼所在目錄 workspaceRoot已被棄用,現(xiàn)改為workspaceFolder
"environment": [],
"externalConsole": true, // 調(diào)試時(shí)是否顯示控制臺(tái)窗口,一般設(shè)置為true顯示控制臺(tái)
"MIMode": "gdb",
"miDebuggerPath": "C:/Program Files (x86)/mingw64/bin/gdb.exe", // miDebugger的路徑,注意這里要與MinGw的路徑對(duì)應(yīng)
"preLaunchTask": "gcc", // 調(diào)試會(huì)話開始前執(zhí)行的任務(wù),一般為編譯程序,c++為g++, c為gcc
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
tasks.json
{
"version": "2.0.0",
"command": "gcc",
"args": [
"-g",
"${file}",
"-o",
"${fileBasenameNoExtension}.exe"
]
}
|