On Thu, Apr 16, 2009 at 12:06 PM, Arthur Schwarz <aschwarz1...@verizon.net> wrote: > > > > Suggested Messaging: Messaging seems redundant in indicating that function > has been redifined twice. One of the messages should be removed. More to the > point, I think the messaging may be erroneous - code fragment follows. > > > g++-4 Diagnostic Messaging > > In file included from partition.cpp:66: > irange.h: In function 'std::ostream& operator<<(std::ostream&, > ciRange_2::sRange_2&)': > irange.h:102: error: redefinition of 'std::ostream& operator<<(std::ostream&, > ciRange_2::sRange_2&)' > irange.h:102: error: 'std::ostream& operator<<(std::ostream&, > ciRange_2::sRange_2&)' previously defined here > > > ---- Code Fragment ---- > class ciRange_2 : public iRange_List { // <low, high> > public: > struct sRange_2 { double RLo; // Low range value > double RHi; }; // High range value > > friend istream& operator>>(istream& stream, ciRange_2::sRange_2& Range); > friend ostream& operator<<(ostream& stream, ciRange_2::sRange_2& Range); > }; // class ciRange_2 > > istream& operator>>(istream& stream, ciRange_2::sRange_2& Range); > > ostream& operator<<(ostream& stream, ciRange_2::sRange_2& Range) { > stream << setw(9) << Range.RLo << " " << setw(9) << Range.RHi; > }
Can you show code that reproduces the issue? My best guess is that a header file is included twice, and lacks guards, hence the message is correct: the function is being defined twice, from the same source location. -- James