I'm using the g++ compiler and used the https://code.visualstudio.com/docs/languages/cpp guide to install everything. Never had any sort of problem.
I can initialise a vector from the standard library, but as soon as I attempt to initialise it with values, or add to it, or print its size after adding to it, I get a blank line in the console. There is no compilation error and i've tried compiling with the -std flag as 'c++11' and 'c++17'. The odd thing is that even if I put a cout statement before I add to the array, then it won't even output anything - it's like it just halts the whole program.
I am using vscode, and I've read of vaguely similar issues but none of the problems are identical and none of the solutions have worked. My code is below:
Imports:
#include <iostream>
#include <limits>
#include <vector>
#include <string>
Main function:
int main()
{
std::cout << "BEFORE";
std::vector<int> data;
std::cout << data.size(); // Sometimes outputs 0 if the vector is not modified but prints nothing if it is(even after the statement)
data.push_back(20);
std::cout << data.size();
std::cout << "AFTER";
}
UPDATE: Flushing the buffer and updating mingw haven't changed anything.