前提・実現したいこと
VSCodeにて、C言語のデバッグ実行ができるようにしたい。
ググって見様見真似で設定していますが、VSCODEが正常動作しない状態です。
現状、VScodeのデバック実行を行うと実行ファイルは作成されますが、
エラーが発生してデバックができない状態です。
解決策やヒントなどご教示頂けると助かります。
発生している問題・エラーメッセージ
VScodeの下記設定を行ってから、デバックの実行を行う。
下図の▶ボタンを実行する。
> Executing task in folder test: C:\MinGW\bin\gcc.exe -g -O0 test.c -otest.exe < ターミナルはタスクで再利用されます、閉じるには任意のキーを押してください。
デバックコンソール
=thread-group-added,id="i1" GNU gdb (GDB) 7.6.1 Copyright (C) 2013 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 "mingw32". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Warning: Debuggee TargetArchitecture not detected, assuming x86_64. =cmd-param-changed,param="pagination",value="off" [New Thread 6720.0x8] [New Thread 6720.0x3f48] Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded. Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded. Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded. The program 'C:\test\test.exe' has exited with code 0 (0x00000000).
設定したこと
構築環境:Windows10
・MinGW のインストール
・Path設定
・cmdでgccの確認
・c_cpp_properties.jsonの作成
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}" ], "defines": [ "_DEBUG", "UNICODE" ], "compilerPath": "c:/mingw/bin/gcc.exe", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "gcc-x64", "browse": { "path": [ "${workspaceFolder}" ], "limitSymbolsToIncludedHeaders": true } } ], "version": 4 }
・launch.jsonの作成
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "c:/mingw/bin/gdb.exe", "windows": { }, "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "Debug Build" } ] }
・tasks.jsonの作成
{ "version": "2.0.0", "tasks": [ { "type": "process", "label": "Debug Build", "command": "gcc", "args": [ "-g", "-O0", "${fileBasename}", "-o${fileBasenameNoExtension}.exe" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": "$gcc" }, ] }
C言語のソース
#include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; }
補足情報
vscodeのターミナルから直接コマンドを叩けば、コンパイルと実行はできています。
コマンドプロンプトから直接コンパイルと実行はできているので、当たり前ですが・・・Orz
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/24 15:05