LoginSignup
nhjnhjnhj
@nhjnhjnhj

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

vscodeでC言語のデバッグをしたいです。

解決したいこと

vscodeでC言語のデバッグが出来るように設定したいのですが、エラーが発生し、デバッグ出来ません。
デバッグ出来るようにしたいです。

発生している問題・エラー

エラーは、作成されたexeファイルがないと表示されます。

該当するソースコード

・Cファイル
#include <stdio.h>
void main()
{
    printf("Hello World!\n");
}
---------------------------------------------------
・launch.json
{
    // IntelliSense を使用して利用可能な属性を学べます。
    // 既存の属性の説明をホバーして表示します。
    // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
        "name": "gcc.exe - アクティブ ファイルのビルドとデバッグ",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "C:\\Program Files (x86)\\x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0\\mingw64\\bin",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\Program Files (x86)\\x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
        "setupCommands": [
        {
            "description": "gdb の再フォーマットを有効にする",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
        ],
        "preLaunchTask": "C/C++: gcc.exe アクティブなファイルのビルド"
    }
    ]
}
---------------------------------------------------
・tasks.json
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe アクティブなファイルのビルド",
            "command": "C:\\Program Files (x86)\\x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0\\mingw64\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "デバッガーによって生成されたタスク。"
        }
    ],
    "version": "2.0.0"
}

自分で試したこと

他サイトを見てtasks.jsonの"args"の中身の変更や、
launch.jsonの"miDebuggerPath"と"cwd"、"program"の変更等を試しましたがどれも上手くいきませんでした。

よろしくお願いいたします。

0

No Answers yet.

Your answer might help someone💌