BlackSmith0040
BlackSmith0040

Reputation: 25

VS Code -- Unexpected Output Format /ERROR\

Im new to stackoverflow and VS Code. When I tried to debug my code I got error message, and couldn't fix it.

I uploaded the error message

and; here is mylaunch.json:

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information,visit: https://go.microsoft.com/fwlink/?linkid=830387
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - Etkin dosyayı derle ve dosyada hata ayıkla",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "gdb için düzgün yazdırmayı etkinleştir",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ]
}

and task.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\TDM-GCC-64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\TDM-GCC-64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Generated task by Debugger"
        }
    ],
    "version": "2.0.0"
}

my main.cpp file is simply printes "Hello"

I installed MinGW and its directory is : C:\MinGW<
I hope there is someone who can help me.

Upvotes: 1

Views: 942

Answers (1)

Albert Lam
Albert Lam

Reputation: 36

I encountered the same problem recently. It seems that the auto-generated tasks.json is not set correctly and the executable is created in the root directory. This can be fixed by changing the type from "cppbuild" to "shell".

{
    "tasks": [
        {
            "type": "shell",
            ...
        }
    ],
    "version": "2.0.0"
}

Upvotes: 2

Related Questions