A
aaragon
Hello, does anyone have a clue about this error? and how to solve it?
It seems to be trivial to me, but not for the compiler. I'm using g++
4.2 on an Ubuntu Linux system:
// main()
....
std:
fstream fout;
fout.open("hello.out");
fout<<setfill('-')<<setw(20)<<"-"<<setfill(' ')<<endl;
fout<<"hello "; // this is line 139
....
main.cxx:89: instantiated from here
main.cxx:139: error: ISO C++ says that these are ambiguous, even
though the worst conversion for the first is better than the worst
conversion for the second:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/
ostream.tcc:735: note: candidate 1: std::basic_ostream<char, _Traits>&
std:
perator<<(std::basic_ostream<char, _Traits>&, const char*) [with
_Traits = std::char_traits<char>]
Domain.h:507: note: candidate 2: o& operator<<(o&, const Domain&)
[with o = std:
fstream]
make: *** [main.o] Error 1
Thank you all!
a²
It seems to be trivial to me, but not for the compiler. I'm using g++
4.2 on an Ubuntu Linux system:
// main()
....
std:
fout.open("hello.out");
fout<<setfill('-')<<setw(20)<<"-"<<setfill(' ')<<endl;
fout<<"hello "; // this is line 139
....
main.cxx:89: instantiated from here
main.cxx:139: error: ISO C++ says that these are ambiguous, even
though the worst conversion for the first is better than the worst
conversion for the second:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/
ostream.tcc:735: note: candidate 1: std::basic_ostream<char, _Traits>&
std:
_Traits = std::char_traits<char>]
Domain.h:507: note: candidate 2: o& operator<<(o&, const Domain&)
[with o = std:
make: *** [main.o] Error 1
Thank you all!
a²