Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.10.0
-
None
-
None
-
Windows XP, Visual Studio 2005, CVS build 11am 12th May 2003
Description
Using the stream.h in a project with more than one object file (i.e. two classes both using the stream logger) causes an error at link time:
File2.obj : error LNK2005: "class log4cxx::logstream & _cdecl operator<<(class log4cxx::logstream &,class std::ios_base & (_cdecl*)(class std::ios_base &))" (??6@YAAAVlogstream@log4cxx@@AAV01@P6AAAVios_base@std@@AAV23@@Z@Z) already defined in File1.obj
Should the stream.h << operators be inline functions? This allows it to compile, but unsure if this is a true fix?
E.g.
::log4cxx::logstream& operator<<(
::log4cxx::logstream& lhs,
const ::log4cxx::LevelPtr& rhs) {
lhs.setLevel(rhs);
return lhs;
}
changes to
inline ::log4cxx::logstream& operator<<(
::log4cxx::logstream& lhs,
const ::log4cxx::LevelPtr& rhs) {
lhs.setLevel(rhs);
return lhs;
}
Chris