I just installed vscode yesterday with MinGW (MinGW itself had a lot of problem downloading from sourceforge though i used osdn) and tried compiling a simple hello world program. The compiling and running of the program works perfectly fine but debugging does not.
VSCode Version:1.42.1 OS Version: Windows 7 ultimate
The program (c++.cpp):
#include <iostream>
using namespace std;
int main()
{
cout << "hello world";
return 0;
}
launch.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": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"preLaunchTask": "echo",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "g++",
"args": [
"-g", "c++.cpp"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
settings.json:
{
"files.associations": {
"iostream": "cpp"
}
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
Error (in PowerShell after g++ -g c++.cpp
):
PS C:\Users\user\Desktop> & 'c:\Users\user\.vscode\extensions\ms-vscode.cpptools-0.26.3\debugAdapters\bin\WindowsDebugLauncher.exe''--stdin=Microsoft-MIEngine-In-uygcczuy.knl''--stdout=Microsoft-MIEngine-Out-mcernddt.mvr''--stderr=Microsoft-MIEngine-Error-2zriwgkx.y0a''--pid=Microsoft-MIEngine-Pid-bxnn4lte.ola''--dbgExe=C:\MinGW\bin\gdb.exe''--interpreter=mi'
This seems to be wrong because after debugging the .exe file is supposed to open in another window right?(or atleast executing the file in the terminal itself) but nothing happens only this message and its done.
I have tried many different answers but none seem to work like Disabling unicode(i changed it to simplified chinese) according to this: https://github.com/Microsoft/vscode-cpptools/issues/1527
Debug console: https://pastebin.com/mqDP8pKg