Using Mingw-w64 in VS Codeの手順に従い、下記のサンプルプログラムを実行してみましたが、エラーメッセージが表示されます。
サンプルプログラム
C++
1#include <iostream> 2#include <vector> 3#include <string> 4 5using namespace std; 6 7int main() 8{ 9 vector<string> msg{"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"}; 10 11 for (const string &word : msg) 12 { 13 cout << word << " "; 14 } 15 cout << endl; 16}
launch.json
json
1{ 2 // IntelliSense を使用して利用可能な属性を学べます。 3 // 既存の属性の説明をホバーして表示します。 4 // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 5 "version": "0.2.0", 6 "configurations": [ 7 { 8 "name": "g++.exe build and debug active file", 9 "type": "cppdbg", 10 "request": "launch", 11 "program": "${fileDirname}\${fileBasenameNoExtension}.exe", 12 "args": [], 13 "stopAtEntry": false, 14 "cwd": "${workspaceFolder}", 15 "environment": [], 16 "externalConsole": false, 17 "MIMode": "gdb", 18 "miDebuggerPath": "C:\mingw-w64\mingw32\bin\gdb.exe", 19 "setupCommands": [ 20 { 21 "description": "gdb の再フォーマットを有効にする", 22 "text": "-enable-pretty-printing", 23 "ignoreFailures": true 24 } 25 ], 26 "preLaunchTask": "g++.exe build active file" 27 } 28 ] 29}
tasks.json
JSON
1{ 2 "version": "2.0.0", 3 "tasks": [ 4 { 5 "type": "shell", 6 "label": "g++.exe build active file", 7 "command": "C:\mingw-w64\mingw32\bin\g++.exe", 8 "args": [ 9 "-g", 10 "${file}", 11 "-o", 12 "${fileDirname}\${fileBasenameNoExtension}.exe" 13 ], 14 "options": { 15 "cwd": "C:\mingw-w64\mingw32\bin" 16 }, 17 "problemMatcher": [ 18 "$gcc" 19 ], 20 "group": { 21 "kind": "build", 22 "isDefault": true 23 } 24 } 25 ] 26}
エラーメッセージは下記の通りです。
=thread-group-added,id="i1" GNU gdb (GDB) 8.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-w64-mingw32". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". Warning: Debuggee TargetArchitecture not detected, assuming x86_64. =cmd-param-changed,param="pagination",value="off" [New Thread 1132.0x39a8] [New Thread 1132.0xd00] [New Thread 1132.0x320c] [New Thread 1132.0x40cc] [Thread 1132.0x40cc exited with code 3221225785] [Thread 1132.0x320c exited with code 3221225785] The program 'c:\Users\user\C++works\VSCode_cpp\cpp_AtCoder.exe' has exited with code 0 (0x00000000). ERROR: Unable to start debugging. GDB exited unexpectedly. ERROR: During startup program exited with code 0xc0000139.
このエラーを解消するにはどうすればいいでしょうか。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。