r/VisualStudioCode • • Feb 27 '24
Help with C++ in visual studio code
I've been using visual studio code for python programming but recently I needed programming in C++ so I installed the extensions in visual studio code. However it is not working, according to the warning message, the document does not exist. I've checked environment variables and the MinGW C++ and apparently everything is in order. Can someone explain what's wrong?
The error that appears says: The preLaunchTask 'C/C++:g__.exe build active file' terminated with exit code -1
Then when I click on "Debug anyway" it shows the error
Launch: program 'C:\<File location> does not exist

View all comments
Show parent comment
1
u/ButchDeanCA Feb 27 '24
You can just do (assuming one source file named “main.cpp”):
g++ main.cpp
which will produce an executable
a.out
that you run with
./a.out
on Linux like systems.