#実現したいこと
vscode上で「C/C++:アクティブファイルのビルドとデバッグ」を行いデバックコンソール上に出力を得たいです。
#発生している問題
「C/C++:アクティブファイルのビルドとデバッグ」を行うとコンパイルはできているのか、exeファイルが生成されました。しかしエラーメッセージ上のpathに実行ファイルが存在するにもかかわらず、ファイルが見つからないというエラーが表示され実行できていません。
※下記のmainはmain.exe、launchはlaunch.json、tasksはtasks.jsonを指しています。
ErrorMessage
Unable to start debugging. Program path 'C:\Users(user_name)\project\main.exe'is missing or invalid. GDB failed with message: C:\Users(user_name)\project\main.exe: No such file or directory. This may occur if the processs's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.
main
#include <stdio.h> int main(void) { printf("Hello World.\n"); return 0; }
launch
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) 起動", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "C:\Program Files\mingw64\bin\gdb.exe", "setupCommands": [ { "description": "gdb の再フォーマットを有効にする", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
tasks
{ "tasks": [ { "type": "cppbuild", "label": "C/C++: gcc.exe アクティブなファイルのビルド", "command": "C:/Program Files/mingw64/bin/gcc.exe", "args": [ "-g", "${file}", "-o", "${fileDirname}\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "C:/Program Files/mingw64/bin" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "デバッガーによって生成されたタスク。" } ], "version": "2.0.0" }
#補足
mingw-w64 は built 4.3.5
vscode は version16.9.311112.23です
まだ回答がついていません
会員登録して回答してみよう