Boost logo

Boost Users :

Subject: [Boost-users] [Graph] Compilation error with MinGW and Boost 1.33.1
From: Florian.PONROY_at_[hidden]
Date: 2009-03-27 07:16:50


Hi,

I have the following compilation error with MinGW 3.4.5, under Linux :

/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_index_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_13
edge_weight_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
buffer_param_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_18
distance_compare_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_18
distance_combine_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
distance_inf_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_15
distance_zero_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_15
graph_visitor_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): multiple
definition of `_s_prop_not_found'
/obj/g++mingwwin32i386_gcc3.4.5-Linux2.6.22.5-jml-051-i686/liblocd_topology_
manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_value_
endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_foundENS_14
vertex_color_tEEERKS5_RKS2_PT_T0_E16s_prop_not_found+0x0): first defined
here

The code compiles fine under Linux with g++ though.

I use both the BGL and Dijkstra algorithm. The adjacency lists are defined
this way:

        typedef boost::adjacency_list<boost::listS,
                                      boost::vecS,
                                      boost::directedS
> tGraphReachable;

        typedef boost::adjacency_list<boost::listS,
                                      boost::vecS,
                                      boost::directedS,
                                      boost::no_property,
                                      boost::property<boost::edge_weight_t,
tLinkWeight>
> tGraphShortestpath;

        typedef tGraphReachable::vertex_descriptor tReachableVertex;
        typedef tGraphShortestpath::vertex_descriptor tDijkstraVertex;
        typedef std::vector<tDijkstraVertex> tPredecessorMap;
        typedef std::vector<tLinkWeight> tDistanceMap;

Call to BFS is done this way:

        tGraphReachable graph(m_nodeList.size());

        // Graph construction
        this->PrepareDataForComputeReachableNodes(graph);

        std::vector<tReachableVertex> reachableNodes;
        reachableNodes.reserve(m_nodeList.size());

        tReachableVertex sourceVertex(boost::vertex(m_localNodeId, graph));

        boost::breadth_first_search(graph, sourceVertex,
                        boost::visitor(
                                boost::make_bfs_visitor(
                                        boost::write_property(
 
boost::identity_property_map(),
 
std::back_inserter(reachableNodes),
 
boost::on_discover_vertex()))));

Call to Dijsktra:

        tGraphShortestpath graph;

        for (tLinkList::const_iterator itLink(links.begin());
             links.end() != itLink;
             ++itLink)
        {
                boost::add_edge((*itLink)->m_sourceId,
                                (*itLink)->m_destinationId,
                                (*itLink)->m_weight,
                                graph);
        }

        tDijkstraVertex sourceVertex(boost::vertex(sourceNode, graph));

        tPredecessorMap predecessors(boost::num_vertices(graph));
        tDistanceMap distances(boost::num_vertices(graph));

        boost::dijkstra_shortest_paths(graph,
                                       sourceVertex,
 
boost::predecessor_map(&predecessors[0])
                                       .distance_map(&distances[0]));

What did I do wrong?

Thanks very much for your help.

-- 
Florian PONROY
Thales Land & Joint France
Tel. : +33(0)1 41 304 363
Fax : +33(0)1 41 303 560
Email : florian.ponroy_at_[hidden]

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