#include<iostream>
#include<string>
using namespace std;
void main(){
string str="abc";
cout<<str;
system("pause");
}
If i do not include string header file then there is an error at << in line cout<
I thought the error will be at line where str is defined.
void main
is not legal. It must returnint
. Anyway, I've noticed MSVC used to be particularly fond of providing everything in<string>
except the I/O through<iostream>
, which is a bit ironic. – chris Jan 5 '14 at 18:39ios_base::failure
(and perhaps some others). But I don't think other unneeded non-member functions, such asto_string
are brought in. – Benjamin Lindley Jan 5 '14 at 18:54