'C++ Code doesn't output in Visual Studio Code when certain data structures are used

I'm running into a weird bug in Visual Studio Code - I'm writing code in C++ using standard extensions (C/C++ extension pack) and if I write a simple program like this, it works fine:


int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    cout << "Hello World!" << endl;
}

However, the second I declare a variable using STD include statements, such as a map, vector, etc., the code runs without errors but doesn't print anything.

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    vector<int> test;
    cout << "Hello World!" << endl; // this no longer prints
}

Any ideas why this error is occurring? I have all the include statements I need as well:

#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source