C++ No output and output code=3221225477, using Visual Studio Code and Windows 11 professional

(I am new to C++)
I set up Visual Studio Code and downloaded the compilers, added them to the environmental path of windows, however now whenever I try to run a simple program as:

#include <iostream>
using namespace std;                                         

int main(void){
    cout << "Hello World";
    return 0;
}

I get no output and I get this code as a result: [Done] exited with code=3221225477 in 0.439 seconds

Seen as this is an access violation error and the fact that this simple program literally does nothing but print Hello World, I became helpless and couldn’t find any solutions online. Any help would be GREATLY appreciated.

Tried reinstalling the compilers g++/gcc (Mingw), as well as trying to run the code through gbd, code runner extension, and running the .exe file, nothing worked. Also tried to reinstall Vscode, but ofcourse didnt work.

  • 2

    uninstall everything and follow the official VSCode Msys2 guide

    – 

  • 2

    3221225477 is 0xc0000005 or an access violation james.darpinian.com/decoder/?q=3221225477 I suspect you are experiencing dll hell cause by having incompatible versions of MinGW runtime installed on your system. Basically if you build using one version of MinGW and have the dlls for the runtime in your PATH environment variable such that windows finds and loads an incompatible dll of the same name you will have UB which thankfully lead to a crash in this case instead of appearing to work even though it was broken.

    – 




  • 3

    Uninstall everything and use visual studio.

    – 

  • 1

    Note: Those runtimes could be part of just about anything. Another mingw install, another programming language that uses the C++ library DLL to backstop it’s inner workings, another program written in C++ via mingw… There are a lot of possibilities. This is exactly why you shouldn’t go the easy route and just throw everything into the system path the way the Internet often advises. You’ll have to go through the path and do some pruning before untinstalling and installing of pretty much anything does you any good.

    – 




  • 1

    Sysinternal’s Process Monitor can help you find which DLL is getting in your way.

    – 

Leave a Comment