Hi Volodya Apologies... I now see that the boost documentation says that the gcc compiler prior to 4.2 does not support anonymous namespaces in precompiled headers. I am using the Darwin compiler that comes with the Apple Servers, and had rather assumed it was based on a current gcc, but I see that it is still based on gcc 4.0.1. The simple workaround is to not use precompiled headers. I have also showed that the problem can be fixed by removing the boost libraries from the pre-compiled headers that use anonymous namespaces, either directly or indirectly. Your other comments were very useful, although I am still looking into why the <use>/boost/filesystem//boost_filesystem is needed in the pch definition on the mac, when it does not appear to be necessary on other platforms. I have found a number of other problems mainly relating to dependency checking that occur on the mac and not on the other platform, so I am going to install a later version of gcc, which will hopefully bring the mac server platform in line with the linux and windows platforms where everything works just fine. Nigel -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Vladimir Prus Sent: 22 February 2009 16:54 To: boost-users@lists.boost.org Subject: Re: [Boost-users] 'Multiply defined' errors in Boost 1.38. Dyer, Nigel wrote:
Hi Volodya
The two boost libraries that cause problems are boost/test and boost/lambda, and if I remove them all is fine in this example.
So, you have a workaround?
The problem only appears with <link>static. If there is no
<link>static
requirement then I get an error message saying that the bio-pch.h.gch is not used because BOOST_SYSTEM_DYN_LINK us defined.
Well, you can add <use>/boost/filesystem//boost_filesystem to the requirements of our pch target so that the PCH is built withe the same defines as the your executable.
I assume that this means that precompiled headers are incompatible with dynamic link builds, although this does not appear to be mentioned.
No, this means that PCH should be built with *exactly* the same compiler options, including defines.
If I define the exe as below in a static build the precompiled header builds with no problems and the code links with no errors. I suspect that by not having the pch as a source this means it is not working as
a
pch however
exe nigel : Lexer/BiobaseLexer.cpp Lexer/ArrayLexer.cpp #/boost/filesystem//boost_filesystem main_nigel.cpp : <variant>static:<source>bio-pch
There's no such variant as 'static', FWIW. There's <link>static - Volodya _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users