Visual Studio Code C++配置文件
生活随笔
收集整理的這篇文章主要介紹了
Visual Studio Code C++配置文件
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
文章目錄
- tasks.json
- launch.json
- c_cpp_properties.json
以下三個文件放在 項目下 .vscode 文件夾中,內(nèi)容從網(wǎng)絡(luò)收集,經(jīng)自己實踐添加修改以備忘
tasks.json
{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format// tasks.json這個文件是定義調(diào)試開始前要執(zhí)行的任務(wù),即(或者絕大多數(shù)是)編譯程序, // 定義了用于編譯程序的編譯器,所輸出的文件格式,使用的語言標準等// 下載mingw-w64 https://www.mingw-w64.org/downloads/"version": "2.0.0","tasks": [{"label": "g++編譯","command": "C:/mingw/bin/g++.exe", // 根據(jù)自己的路徑修改,記得添加bin路徑到path環(huán)境變量"args": ["${file}","-o","${fileDirname}/${fileBasenameNoExtension}.exe","-g","-static-libgcc","-fdiagnostics-color=always","-std=c++14" // 如果c++17報錯,可能編譯器不支持,嘗試降低版本],"type": "shell","group": {"kind": "build","isDefault": true},"presentation": {"echo": true,"reveal": "always","focus": true,"panel": "shared"},"options": {"cwd": "${fileDirname}"},"problemMatcher": ["$gcc"],},] }launch.json
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", // 配置名稱,將會在啟動配置的下拉菜單中顯示 "type": "cppdbg", // 配置類型,這里只能為cppdbg "request": "launch", // 請求配置類型,可以為launch(啟動)或attach(附加) "program": "${fileDirname}/${fileBasenameNoExtension}.exe",// 將要進行調(diào)試的程序的路徑 "args": [], // 程序調(diào)試時傳遞給程序的命令行參數(shù),一般設(shè)為空即可 "stopAtEntry": false, // 設(shè)為true時程序?qū)和T诔绦蛉肟谔?#xff0c;一般設(shè)置為false "cwd": "${fileDirname}", // 調(diào)試程序時的工作目錄,一般為${fileDirname}即代碼所在目錄 "environment": [], "externalConsole": false, // 調(diào)試時是否顯示控制臺窗口"MIMode": "gdb", "miDebuggerPath": "C:/mingw/bin/gdb.exe", // miDebugger的路徑,注意這里要與MinGw的路徑對應(yīng) "preLaunchTask": "g++編譯", // 跟 tasks.json 的 label 字段一致"setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }c_cpp_properties.json
{"configurations": [{"name": "Win32","includePath": ["${workspaceFolder}/**","C:/mingw/include/*" // 根據(jù)自己的需要添加多個],"defines": ["_DEBUG","UNICODE","_UNICODE"],"compilerPath": "C:/mingw/bin/gcc.exe", // 修改為自己的路徑"cStandard": "c11","cppStandard": "c++14", // 如果c++17報錯,可能編譯器不支持,嘗試降低版本"intelliSenseMode": "gcc-x64"}],"version": 4 }總結(jié)
以上是生活随笔為你收集整理的Visual Studio Code C++配置文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: LeetCode 1971. Find
- 下一篇: s3c2440移植MQTT