I'm a complete novice to VS code, and I've only been coding with C++ for around a month. I tried this bare bones program to make sure things were set up correctly:
#include <iostream>
#include <vector>
using namespace std;
int main() {
cout << "Hello world" << endl;
vector<int> v;
return 0;
}
Nothing shows up when running the executable. Removing the vector declaration causes the program to run normally.
I did find this which encountered a similar problem with declaring a string, and the solution (static linking with -static-libstdc++) works for me, though the author who gave the solution wasn't entirely sure why it worked either.
However, since I'm a noob, I don't understand that well why static linking fixed my problem, even after reading this, and am worried about some of the drawbacks mentioned (it recommends only linking statically if you absolutely have to since disadvantages outweight advantages), so I was wondering if there was some other solution besides static linking.
EDIT: Clarification--the program's outputs now show up normally in terminal, but in the output window, the same exit code still appears.