'What should I do to avoid a C++ program 0xc000007b error using VS Code?

I have recently installed VSC on my Win10 PC.

I was trying my first Hello world program in C++.

Building the program was successful.

#include<iostream>
using namespace std;

int main(){

    cout<<"Hello world!"<<endl;

    return 0;
}

Execution of the corresponding .exe file gave me the error 0xc000007b.

The interesting thing is that in the past I have installed minGW. Selecting that compiler today, no error appears and I can run the .exe file and see Hello world! displayed in the Windows console.

Today I have installed minGW-w64. As minGW it is in my C:\ disk.

If I write in the VSC console g++ --version I can read:

g++.exe (MinGW.org GCC Build-20200227-1) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

No mention of minGW-w64.

In the compiler I can choose it though...

image

I have created an environment variable for my user C:\msys64\mingw64\bin in path, too.

Any ideas how to fix my problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source