microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beginning C++ Tutorial

Absdidhav opened this issue · comments

I've just set up Using GCC with MinGW and tried to compile and run the first program "Hello World" by copying and pasting it into VS.
When I ran the program it came up with the following error message:

The preLaunchTask 'C/C++: gcc.exe build active file' terminated with the exit code -1

I also noticed that there were only two files that were created in the workspace .vscode folder:
tasks.json and
launch.json

c_cpp_properties.json was NOT CREATED

What's wrong?
Can you please advise?

I tried deleting the .vscode folder and re compiling/running the program. When it asked me for the build version, I changed from gcc.exe to g++.exe. I think that solved my problem!

Here is the output:
\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-1idt0205.joy' '--stdout=Microsoft-MIEngine-Out-cmjd1clq.tz2' '--stderr=Microsoft-MIEngine-Error-2reocxlg.ejw' '--pid=Microsoft-MIEngine-Pid-r2rvxqf2.wiy' '--dbgExe=C:\msys64\ucrt64\bin\gdb.exe'
'--interpreter=mi'
Hello C++ World from VS Code and the C++ extension!
PS C:\Users\Andrew\projects\helloworld>

@Absdidhav, transferring your issue to the C++ tools repo for the team to pick it up there.

@Absdidhav If you are compiling in C++, please ensure you are using a g++ compiler instead of gcc. It seems like you already fixed your issue so I will close this issue now.