vendredi 23 mars 2018

c++: When defining variable of STL, no input is shown in command prompt

Really simple code:

#include<iostream>
using std::cout
int main()
{
  cout<<"hi\n";
  return 0;
}

This would display "hi" in the prompt as expected. But if I include any STL:

#include<iostream>
#include<vector>
using std::cout;
using std::vector;
int main()
{
  vector<int> v;
  cout<<"hi\n";
  return 0;
}

Nothing is showing in the prompt, no "hi", no error message. I thought this issues might have something to do with my gcc version since libraries from C works fine (like cstring). However, I installed MinGW just like I did on all other computers, and the code runs perfectly on those computers. Can anyone help me with this issue? Thank you so much!

Aucun commentaire:

Enregistrer un commentaire