So I just started setting up C++ on Visual Studio Code, new programmer here. I did my research and downloaded this thing called Min GW GCC. Then I went into visual studio code, pressed debug, no dice. It said "g++.exe" cannot be found. So I googled it and some stuff online said to set the path to MinGw. I did User:\MinGW\bi in "System Environment Variables", created a new variable, and copy pasted that and pressed okay.

I go back into VS Code with and press the "debug" button. I get an immediate error and it says this:


Starting: "C:\MinGW\bin\g++.exe" --interpreter=mi
g++.exe: error: unrecognized command line option '--interpreter=mi'
g++.exe: fatal error: no input files
compilation terminated.
"C:\MinGW\bin\g++.exe" exited with code 1 (0x1).


I don't understand what this means? I opened up launch.json.

{
    "version": "0.2.0",
    "configurations": [


        {
            "name": "g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true, //set to true to see output in cmd instead
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\g++.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++.exe build active file"
        },
        {
            "name": "g++ build & run active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false, //set to true to see output in cmd instead
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ build & run active file"
        }
    ]
}

I pressed debug and it says open launch.json. I dont know what is and dont understand it at all so I copy pasted for your view so you can help and explain it. Please help me out I cannot make this work.

Also I don't even know what task.json and launch.json means, I just want to run my damn code :(

0 Answers