On Wed, Dec 28, 2005 at 09:58:54PM +0200, Peter Dimov wrote:
Gennadiy Rozental wrote:
I had the same problem with vc 7.1.
Strange. I never had problems like this with vc7.1
If you add 'static' to all variables definitions in anonymous namespaces it works fine.
But anonimous namespace should do the trick itself!
Many compilers have such problems when using precompiled headers, take a look at boost/bind/placeholders.hpp for a list.
GCC has reported bugs with precompiled headers and anonymous namespaces. However, I didn't request precompiled headers, and I'm not even sure that g++ 3.3 (which I used, though the Apple variant) has them. See gcc bug 10591 (which specifically mentions boost) for 3.4. One comment suggests it works in 4.0.0, but basically the same bug is also reported againt 4.0 (21179). There seems to be considerable uncertainty about the best way to fix the bug, and, probably as a result, not much sign of it being worked on. Ross P.S. Among the problems with the use of -m that I reported earlier is that erroneous duplicate symbols are likely to be missed, by the compiler because -m says let it pass, and by you because there may be a blizzard of bogus duplicate warnings. Presumably most of the other hazards of -m involve cases in which the "duplicate" symbols have different definitions. Since the symbols are being generated from the same include file in each compilation unit in my case (using boost test macros), that's not such a concern here.