c++ - enum error?
- CY (19/19) Aug 05 2002 I have written a small piece of code as follows:
- Jan Knepper (3/20) Aug 05 2002 Jan
I have written a small piece of code as follows: #include <iostream.h> int main() { enum num {one=1,two,three,four,five}; num x = three; cout << "x=" << x << endl; return 0; } But when I compile with DM compiler it gives this error: C:\dm\bin>sc test.cpp cout << "x=" << x << endl; ^ test.cpp(6) : Error: ambiguous reference to symbol Had: ostream::operator <<(char ) and: ostream::operator <<(long double ) --- errorlevel 1 What does it mean and how can I solve this? There is no problem when I compile it using VC++. Thanks!
Aug 05 2002
CY wrote:I have written a small piece of code as follows: #include <iostream.h> int main() { enum num {one=1,two,three,four,five}; num x = three; cout << "x=" << x << endl; return 0; } But when I compile with DM compiler it gives this error: C:\dm\bin>sc test.cpp cout << "x=" << x << endl;cout << "x=" << ( int ) x << endl;test.cpp(6) : Error: ambiguous reference to symbol Had: ostream::operator <<(char ) and: ostream::operator <<(long double ) --- errorlevel 1 What does it mean and how can I solve this? There is no problem when I compile it using VC++.Jan
Aug 05 2002