vscode c++環境構成
5889 ワード
vscode c++環境構成参照回答新規.vscodeフォルダ構成tasks.jsonファイル
設定json
構成launch.json
c_の設定cpp_properties.json
jsonというものがよくわからないので、覚えておきます
{
"version": "2.0.0",
"tasks": [
{
"label": "Compile", // , launch.json preLaunchTask
"command": "g++", //
"args": [
"${file}",
"-o", // , a.exe,Linux a.out
"${fileDirname}/${fileBasenameNoExtension}.exe",
"-g", //
//"-Wall", //
"-static-libgcc", //
//"-fcolor-diagnostics", // ? clang gcc
//"--target=x86_64-w64-mingw", // clang target msvc, ;Linux
"-std=c++17" // C c11,
], //
"type": "shell", // shell process, shell ,
"group": {
"kind": "build",
"isDefault": true // false tasks.json , ,
},
"presentation": {
"echo": true,
"reveal": "always", // “ ” , always,silent,never。 VSC
"focus": false, // true task , c c++ , true
"panel": "shared" //
}
// "problemMatcher":"$gcc" // clang, , 。 ( )
}
]
}
設定json
{
"files.defaultLanguage": "cpp", // ctrl+N
"editor.formatOnType": true, // , ,
"editor.snippetSuggestions": "top", // snippets
"code-runner.runInTerminal": true, // false “ ” ,
"code-runner.executorMap": {
"c": "cd $dir && clang $fileName -o $fileNameWithoutExt.exe -Wall -g -Og -static-libgcc -fcolor-diagnostics --target=x86_64-w64-mingw -std=c11 && $dir$fileNameWithoutExt",
"cpp": "cd $dir && clang++ $fileName -o $fileNameWithoutExt.exe -Wall -g -Og -static-libgcc -fcolor-diagnostics --target=x86_64-w64-mingw -std=c++17 && $dir$fileNameWithoutExt"
}, // code runner
"code-runner.saveFileBeforeRun": true, // run code
"code-runner.preserveFocus": true, // false,run code 。 false
"code-runner.clearPreviousOutput": false, // run code code runner
"C_Cpp.clang_format_sortIncludes": true, // include ( )
"C_Cpp.intelliSenseEngine": "Default", // Default Tag Parser, , 。 cpptools
"C_Cpp.errorSquiggles": "Disabled", // clang lint,
"C_Cpp.autocomplete": "Disabled", // clang ,
"clang.cflags": [ // c
"--target=x86_64-w64-mingw",
"-std=c11",
"-Wall"
],
"clang.cxxflags": [ // c++
"--target=x86_64-w64-mingw",
"-std=c++17",
"-Wall"
],
"clang.completion.enable":true // cpptools
}
構成launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch", // ,
"type": "cppdbg", // , cppdbg
"request": "launch", // , launch( ) attach( )
"program": "${fileDirname}/${fileBasenameNoExtension}.exe", //
"args": [], // ,
"stopAtEntry": false, // true , true
"cwd": "${workspaceFolder}", //
"environment": [], // ( ?)
"externalConsole": true, // , true
"internalConsoleOptions": "neverOpen", // neverOpen, “ ” , gdb ?
"MIMode": "gdb", // , gdb lldb。 lldb windows 。
"miDebuggerPath": "gdb.exe", // ,Windows ,Linux
"setupCommands": [ // ,
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
],
"preLaunchTask": "Compile" // , 。 tasks.json label
}
]
}
c_の設定cpp_properties.json
{
"configurations": [
{
"name": "MinGW",
"intelliSenseMode": "clang-x64",
"compilerPath": "C:/MinGW/bin/gcc.exe",
"includePath": [
"${workspaceFolder}"
],
"defines": [],
"browse": {
"path": [
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
jsonというものがよくわからないので、覚えておきます