c++ - enum error?
- "CY" <lcy hkem.com> Aug 05 2002
- Jan Knepper <jan smartsoft.cc> Aug 05 2002
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








Jan Knepper <jan smartsoft.cc>