newbie: Graph library - bundled properties

I try to use the Boost Graph library bundled properties which is introduced in 1.32.0. I modify the sample program libs/graph/example/graph_property.cpp which then fail to compile, I don't know enough about bundled properties to fix it. Please help. Thanks. I use gcc version 3.4.2 (Gentoo Linux 3.4.2-r2, ssp-3.4.1-1, pie-8.7.6.5). graph_property.cpp source code is: int main() { using namespace boost; using std::string; struct edgeStruct { int weight; }; typedef adjacency_list<vecS, vecS, directedS,no_property, edgeStruct, property<graph_name_t, string> > graph_t; graph_t g; get_property(g, graph_name) = "graph"; graph_t::vertex_descriptor v = *vertices(graph_t).first; graph_t::edge_descriptor e = *out_edges(v, graph_t).first; g[e].weight = 1; std::cout << "name: " << get_property(g, graph_name) << std::endl; typedef subgraph<graph_t> subgraph_t; subgraph_t sg; get_property(sg, graph_name) = "subgraph"; std::cout << "name: " << get_property(sg, graph_name) << std::endl; return exit_success; } //compile output is: gcc-C++-action /home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on/graph_property.o /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp: In function `int main()': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:21: error: `main()::edgeStruct' uses local type `main()::edgeStruct' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:21: error: trying to instantiate `template<class OutEdgeListS, class VertexListS, class DirectedS, class VertexProperty, class EdgeProperty, class GraphProperty, class EdgeListS> class boost::adjacency_list' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:21: error: ISO C++ forbids declaration of `graph_t' with no type /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:24: error: no matching function for call to `get_property(main::graph_t&, boost::graph_name_t)' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:25: error: `graph_t' is not a class or namespace /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:25: error: `vertex_descriptor' undeclared (first use this function) /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:25: error: (Each undeclared identifier is reported only once for each function it appears in.) /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:25: error: expected `;' before "v" /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:26: error: `graph_t' is not a class or namespace /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:26: error: `edge_descriptor' undeclared (first use this function) /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:26: error: expected `;' before "e" /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:27: error: `e' undeclared (first use this function) /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:29: error: no matching function for call to `get_property(main::graph_t&, boost::graph_name_t)' /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp: At global scope: /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp: In instantiation of `boost::graph_traits<main::graph_t>': /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:66: instantiated from `boost::subgraph<main::graph_t>' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:33: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:41: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:42: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:43: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:44: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:45: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:46: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:47: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:49: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:50: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:51: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:53: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:54: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:55: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/graph_traits.hpp:63: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp: In instantiation of `boost::subgraph<main::graph_t>': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:33: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:66: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:67: error: no type named `edge_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:68: error: no type named `directed_category' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:69: error: no type named `edge_parallel_category' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:70: error: no type named `traversal_category' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:73: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:79: error: no type named `out_edge_iterator' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:80: error: no type named `degree_size_type' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:83: error: no type named `adjacency_iterator' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:86: error: no type named `vertex_iterator' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:87: error: no type named `vertices_size_type' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:90: error: no type named `edge_iterator' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:91: error: no type named `edges_size_type' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:93: error: no type named `in_edge_iterator' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:95: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:96: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:99: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:108: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:112: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:162: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:166: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:173: error: no type named `edge_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:177: error: no type named `edge_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:186: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp: In instantiation of `boost::detail::edge_property_map<main::graph_t, boost::edge_index_t>': /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:219: instantiated from `boost::property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:247: instantiated from `boost::subgraph<main::graph_t>' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:33: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:160: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:161: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:162: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:164: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:164: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:165: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:165: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:166: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:166: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp: In instantiation of `boost::property_map<main::graph_t, boost::edge_index_t>': /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:247: instantiated from `boost::subgraph<main::graph_t>' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:33: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:219: error: no type named `type' in `struct boost::detail::edge_property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:220: error: no type named `const_type' in `struct boost::detail::edge_property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp: In instantiation of `boost::subgraph<main::graph_t>': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:33: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:247: error: no type named `type' in `struct boost::property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:248: error: no type named `type' in `struct boost::property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:249: error: no type named `type' in `struct boost::property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:249: error: `value' is not a member of `<declaration error>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:249: error: `value' is not a member of `<declaration error>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:249: error: size of array has non-integral type `<type error>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:254: error: no type named `type' in `struct boost::property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:256: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:257: error: no type named `vertex_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:258: error: no type named `edge_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:259: error: no type named `type' in `struct boost::property_map<main::graph_t, boost::edge_index_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:264: error: no type named `edge_descriptor' in `struct boost::graph_traits<main::graph_t>' /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp: In instantiation of `boost::graph_property<main::graph_t, boost::graph_name_t>': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:34: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:235: error: `main::graph_t' is not a class, struct, or union type /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp: In function `int main()': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:34: error: no matching function for call to `get_property(main()::subgraph_t&, boost::graph_name_t)' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:36: error: no matching function for call to `get_property(main()::subgraph_t&, boost::graph_name_t)' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp: In constructor `boost::subgraph<Graph>::subgraph() [with Graph = main::graph_t]': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:33: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:106: error: unnamed initializer for `boost::subgraph<main::graph_t>', which has no base classes set -e "g++" -c -Wall -ftemplate-depth-255 -g -O0 -Wno-inline -I"../../../bin/boost/libs/graph/example" -I "/home/tcma/cpp/boost_1_32_0" -o "/home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on/graph_property.o" "/home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp" "/usr/bin/objcopy" --set-section-flags .debug_str=contents,debug "/home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on/graph_property.o" ...failed gcc-C++-action /home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on/graph_property.o... ...skipped </home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on>/home/tcma/cpp/boosttcma/libs/graph/graph_property for lack of </home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on>graph_property.o... ...skipped </home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on>/home/tcma/cpp/boosttcma/libs/graph/graph_property.run for lack of </home/tcma/cpp/boosttcma/libs/graph/graph_property.test/gcc/debug/inlining-on>/home/tcma/cpp/boosttcma/libs/graph/graph_property... ...failed updating 1 target... ...skipped 3 targets... ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca

On Nov 22, 2004, at 8:25 PM, TC MA wrote:
int main() { using namespace boost; using std::string;
Move this struct...
struct edgeStruct { int weight; };
outside of main, because of this error message:
/home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:21: error: `main()::edgeStruct' uses local type `main()::edgeStruct'
Doug
participants (2)
-
Doug Gregor
-
TC MA