Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost 1.44][BGL] Compiling error with MinGW
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-11-09 11:41:10


On Tue, 9 Nov 2010, Florian.PONROY_at_[hidden] wrote:

>
> Hi folks,
>
> My C++ Windows/Linux project used to compile properly using the following items:
>
> * Boost 1.33.1, using BGL, Serialization, Thread ;
> * GNU g++ 4.1.2 under Linux ;
> * MinGW 3.4.5 under Linux (cross-compiling).
>
> I recently updated my Boost distribution to version 1.44. Unfortunately, I now have the following BGL/linking error
> compiling with MinGW :
>
> /path/to/liblocd_topology_manager.a(locTopology.o):locTopology.cpp:(.rdata$_ZZN5boost3putINS_26vec_adj_list_vertex_
> id_mapINS_8propertyINS_13vertex_root_tEiNS_11no_propertyEEEjEEEEvRKNS_17two_bit_color_mapIT_EENS_15property_traitsI
> S8_E8key_typeENS_18two_bit_color_typeEE17elements_per_char+0x0): multiple definition of `_elements_per_char'
>
> /path/to/liblocd_topology_manager.a(locTopology.o):locTopology.cpp:(.rdata$_ZZN5boost3putINS_26vec_adj_list_vertex_
> id_mapINS_8propertyINS_13vertex_root_tEiNS_11no_propertyEEEjEEEEvRKNS_17two_bit_color_mapIT_EENS_15property_traitsI
> S8_E8key_typeENS_18two_bit_color_typeEE17elements_per_char+0x0): first defined here
>
> I've checked the //www.boost.org/doc/libs/1_44_0/libs/graph/doc/trouble_shooting.html webpage, but I haven't seen
> any answer related to my problem.
>
> For sure, the MinGW compiler version we use is pretty old. Since updating it would be very cumbersome in our case, I
> would like to be sure it's actually a compiler issue.
>
> Thanks in advance for your advice.

This looks like a compiler issue -- elements_per_char is a static constant
(using BOOST_STATIC_CONSTANT), so it should not have any linkage problems
like what you're having. I'm not an expert on MinGW, so I don't know the
cause of the issue; it looks similar to
<URL:http://efreedom.com/Question/1-1974077/Vector-Multiple-Definition-Link-Errors>,
though.

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net