This is the mail archive of the
mailing list for the libstdc++ project.
Re: multiple definition of operator<< ?
- To: Thorsten Gecks <t_gecks at informatik dot uni-kl dot de>
- Subject: Re: multiple definition of operator<< ?
- From: David Greene <greened at eecs dot umich dot edu>
- Date: Sun, 10 Dec 2000 10:55:25 -0500 (EST)
- cc: libstdc++ at sourceware dot cygnus dot com
- Reply-To: greened at eecs dot umich dot edu
On Sun, 10 Dec 2000, Thorsten Gecks wrote:
> ifndef KSIMONSTRUCTS_HH
> #define KSIMONSTRUCTS_HH
> ostream & operator<<(ostream & os, const KSimoN::DocUnitPosition & pos)
> return os << '(' << pos.x << ',' << pos.y << ',' << pos.z << ')';
You've defined this in a header file. To prevent multiple instances
of the function from conflicting, there are a few options. You
can make it inline, make it static or you can guard it with an
#ifdef so that it will only appear in a single source file.
Or just move it to a source file and only place the declaration in the
header. Personally, with these kinds of functions I either make them
inline or just put them in the right source file.
"Some little people have music in them, but Fats, he was all music,
and you know how big he was." -- James P. Johnson