Re: [Boost-users] [Graph] Compilation error with MinGW and Boost 1.33.1
Weird. It has something to do with compiler optimizations. If -O2 is enabled, these errors disappear... I try to figure out why.
-----Message d'origine----- De : PONROY Florian - CLB Envoyé : vendredi 27 mars 2009 12:17 À : boost-users@lists.boost.org Objet : [Graph] Compilation error with MinGW and Boost 1.33.1
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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_13edge_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14buffer_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_18distance_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_18distance_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14distance_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_15distance_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_15graph_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_topolog y_manager.a(topology.o):topology.cpp:(.data$_ZZN5boost6detail18property_va lue_endINS_11no_propertyEE15const_get_valueINS0_24error_property_not_found ENS_14vertex_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@fr.thalesgroup.com
participants (1)
-
Florian.PONROY@fr.thalesgroup.com