August 05, 2002 enum error? | ||||
---|---|---|---|---|
| ||||
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! |
August 05, 2002 Re: enum error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to CY | 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 |
Copyright © 1999-2021 by the D Language Foundation