There is an extension for C++ on VS Code and I’d like to try it!!
So I started reading those boring docs on MS VS Code Official website to install and set up the environment.
However, when thing look success, it’s actually suck 💀. When I try to run it with C/C++ extension from Microsoft, it appears this extremely haunting message: exit code -1
And the terminal send this message to me:
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file D:\H?C T?P\WORK STATION\C++\Hello world\helloworld.exe: Invalid argument
There seems no problem with the code because I’m copying it from VS Code Doc 🤡:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
I think that there is a problem with the environment and compiler. But:
Also, VS Code also generate .vscode
folder which contain only launch.json
, tasks.json
And here is the content in each file:
{
// 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": []
}
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\msys64\ucrt64\bin\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
pls someone help 😭
7