I have a persistent problem with my compiler (Microsoft Visual C++ 6.0). Whenever I override the extraction and insertion (<< and >>) operators in a header file for a class, I get errors when I try to compile the .cpp file, but only if I am using the iostream header file. The errors don't appear when I use the iostream.h header file.
The same code will compile fine on other computers, so I assume it's a compiler setting, but nobody I've asked knows what it is.
Does anyone know what the setting is that needs to be changed so that these lines of code:
will compile properly?
Some of the error messages include:
error C2433: 'ostream' : 'friend' not permitted on data declarations
error C2501: 'ostream' : missing storage-class or type specifiers
error C2244: 'ostream' : unable to resolve function overload
error C2061: syntax error : identifier 'ostream'
error C2501: '<<' : missing storage-class or type specifiers
Thank you.
The same code will compile fine on other computers, so I assume it's a compiler setting, but nobody I've asked knows what it is.
Does anyone know what the setting is that needs to be changed so that these lines of code:
Code:
friend ostream& operator <<
friend istream& operator >>
will compile properly?
Some of the error messages include:
error C2433: 'ostream' : 'friend' not permitted on data declarations
error C2501: 'ostream' : missing storage-class or type specifiers
error C2244: 'ostream' : unable to resolve function overload
error C2061: syntax error : identifier 'ostream'
error C2501: '<<' : missing storage-class or type specifiers
Thank you.