実現したいこと
VScodeでF5だけでc++スクリプトを実行したい
前提
こちらのサイトを参考に実装しました。
https://qiita.com/yu_yujan/items/caef83c9558110cae622
コンパイラはMinGW-w64です。
https://github.com/niXman/mingw-builds-binaries/releases/tag/13.2.0-rt_v11-rev0
発生している問題・エラーメッセージ
F5で実行したときの最初の画面
このままデバッグ(D)を押した後の画面
c_cpp_properties.json
1{ 2 "configurations": [ 3 { 4 "name": "Win32", 5 "includePath": [ 6 "${workspaceFolder}/**" 7 ], 8 "defines": [ 9 "_DEBUG", 10 "UNICODE", 11 "_UNICODE" 12 ], 13 "compilerPath": "C:/mingw64/bin/g++.exe", 14 "cStandard": "gnu17", 15 "cppStandard": "gnu++14", 16 "intelliSenseMode": "gcc-x64" 17 }, 18 { 19 "name": "gcc_exe", 20 "includePath": [ 21 "${workspaceFolder}/**", 22 "C:/mingw-w64/mingw64/**" 23 ], 24 "defines": [ 25 "_DEBUG", 26 "UNICODE", 27 "_UNICODE" 28 ], 29 "compilerPath": "C:/mingw64/bin/g++.exe", 30 "cStandard": "gnu17", 31 "cppStandard": "gnu++14", 32 "intelliSenseMode": "gcc-x64" 33 } 34 ], 35 "version": 4 36}
tasks.json
1{ 2 "version": "2.0.0", 3 "tasks": [ 4 { 5 "type": "cppbuild", 6 "label": "C/C++: g++.exe build active file", 7 "command": "C:/mingw64/bin/g++.exe", 8 "args": [ 9 "-g", 10 "${file}", 11 "-o", 12 "${fileDirname}/${fileBasenameNoExtension}.exe" 13 ], 14 "options": { 15 "cwd": "C:/mingw64/bin" 16 }, 17 "problemMatcher": [ 18 "$gcc" 19 ], 20 "group": { 21 "kind": "build", 22 "isDefault": true 23 }, 24 "detail": "compiler: C:/mingw64/bin/g++.exe" 25 } 26 ] 27} 28
launch.json
1{ 2 "version": "0.2.0", 3 "configurations": [ 4 { 5 "name": "gcc.exe - アクティブ ファイルのビルドとデバッグ", 6 "type": "cppdbg", 7 "request": "launch", 8 "program": "${fileDirname}/${fileBasenameNoExtension}.exe", 9 "args": [], 10 "stopAtEntry": false, 11 "cwd": "${workspaceFolder}", 12 "environment": [ 13 { 14 "name": "PATH", 15 "value": "%PATH%;C:/mingw64/bin" 16 } //C++のデバッグと実行にはこの設定が必要っぽいです 17 ], 18 "externalConsole": false, 19 "MIMode": "gdb", 20 "miDebuggerPath": "C:/mingw64/bin/gdb.exe", 21 "setupCommands": [ 22 { 23 "description": "gdb の再フォーマットを有効にする", 24 "text": "-enable-pretty-printing", 25 "ignoreFailures": true 26 } 27 ], 28 "preLaunchTask": "C/C++: g++.exe build active file" 29 } 30 ] 31}
補足情報(FW/ツールのバージョンなど)
通常のやり方で実行することはできます。
