[foreach] Multiple definition error when linking two foreach-using units

19 Mar
2005
19 Mar
'05
1:30 p.m.
I've attached two (tiny) files: a.cpp and b.cpp . They compile fine, but attempting to link them causes the following error: b.o(.text+0x0):b.cpp: multiple definition of `boost::foreach_detail_::cheap_copy(...)' a.o(.text+0x0):a.cpp: first defined here I'm using gcc 3.4.2 with boost 1.32 and foreach.hpp revision 1.29 from the sandbox. Making the non-template cheap_copy() in foreach.hpp at line 322 inline solves the problem. Regards, Eelis #include <boost/foreach.hpp> int main () {} #include <boost/foreach.hpp>
7441
Age (days ago)
7441
Last active (days ago)
1 comments
2 participants
participants (2)
-
Eelis van der Weegen
-
Eric Niebler