This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
changes between 3.4 and 4.1.2 / Problem with endl overload
- From: area2051 at gmx dot de
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 17 Apr 2007 12:27:49 +0200
- Subject: changes between 3.4 and 4.1.2 / Problem with endl overload
- References: <1176803579.10872.ezmlm@gcc.gnu.org>
Hello Users,
i've got a problem with the current gnu compiler.
Let me discribe my situation:
My projekt compiles under 3.4 very well.
It has an overload funktion in a class named ABA_Ostream for the std::endl function with the functionality that in dependence of a flag set in a config-file the output will be written in std::out and/ or to a local file.
In this case, of course, only the endl command.
the headerfile looks like that:
class ABA_OSTREAM:public ostream,public ABA_ABACUSROOT{
public:
....
friend ABA_OSTREAM& endl(ABA_OSTREAM &o);
....
private:
/*! \brief The ``real'' stream associated with our output stream
* (usually \a cout or \a cerr).
*/
ostream &out_;
/*! \brief If \a true, then output is written to the stream \a out_,
* otherwise it is suppressed.
*/
bool on_;
/*! \brief If \a true_, then output is also written to the
* log stream \a *log.
*/
bool logOn_;
/*! A pointer to a stream associated with the log file.
*/
ofstream *log_;
-------------------------------
the sourcecode is here:
ABA_OSTREAM& endl(ABA_OSTREAM &o)
{
o << '\n';
if (o.on_) o.out_ << flush;
if(o.logOn_) *(o.log_) << flush;
return o;
}
-------------------------------
When i try to compile with the version 4.1.2. there occurs a lot of errors, because the endl function is not found.
...............................
g++-4.1 -I./Include -DABACUS_SYS_LINUX -DABACUS_COMPILER_GCC34 -Wall -O3 -c sources/lp.cc -o tmp/linux20-gcc41/lp.o
./Include/abacus/array.inc: In member function 'const ABA_ARRAY<Type>& ABA_ARRAY<Type>::operator=(const ABA_BUFFER<Type>&)':
./Include/abacus/array.inc:159: error: no match for 'operator<<' in '(((ABA_ARRAY<Type>*)this)->ABA_ARRAY<Type>::glob_->.ABA_GLOBAL::err() << "size of ABA_ARRAY too small.") << std::endl'
./Include/abacus/ostream.h:93: note: candidates are: ABA_OSTREAM& ABA_OSTREAM::operator<<(char)
./Include/abacus/ostream.h:94: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(unsigned char)
./Include/abacus/ostream.h:95: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(signed char)
./Include/abacus/ostream.h:96: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(short int)
./Include/abacus/ostream.h:97: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(short unsigned int)
./Include/abacus/ostream.h:98: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(int)
./Include/abacus/ostream.h:99: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(unsigned int)
./Include/abacus/ostream.h:100: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(long int)
./Include/abacus/ostream.h:101: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(long unsigned int)
./Include/abacus/ostream.h:102: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(float)
./Include/abacus/ostream.h:103: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(double)
./Include/abacus/ostream.h:104: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(const char*)
./Include/abacus/ostream.h:118: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(ABA_OSTREAM& (*)(ABA_OSTREAM&))
./Include/abacus/ostream.h:119: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(const ABA_STRING&)
./Include/abacus/ostream.h:120: note: ABA_OSTREAM& ABA_OSTREAM::operator<<(const ABA_TIMER&)
.....................................
I tried everything.
1. replace '<<endl' with '<<std::endl'
This will be accepted under 3.4 but not under 4.1
(not defined in that scope)
2. explicit ABA_Ostream::endl.
the same error message
3.the last test with std::endl(streamname) was accepted by both versions.
But this includes the normal behavior of the std::endl function and not the overloaded endl-function.
So i would be very glad, if anyone has an idea or a hint for my (silly) Problem.
Or do you know any changes between 3.4 and 4.1.2 that belongs to my problem?
Greetings
Mark Sprenger
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail