You are not properly introducing your custom properties to boost.graph.
As an example of doing this correctly:
using std::string;
struct edgeStruct {
int weight;
};
struct graphStruct {
string name;
};
// create a tag for custom graph/edge properties
enum graph_Datum_t { graph_Datum };
enum edge_Datum_t { edge_Datum };
namespace boost {
BOOST_INSTALL_PROPERTY(graph,Datum);
BOOST_INSTALL_PROPERTY(edge,Datum);
}
typedef boost::property
After modifying it, still had some compile problems. using std::string; struct edgeStruct { int weight; }; struct graphStruct { string name; };
int main() { using namespace boost;
typedef adjacency_list
graph_t; graph_t g; graph_t::vertex_descriptor v = *vertices(g).first; graph_t::edge_descriptor e = *out_edges(v, g).first; g[e].weight = 1; g[e].name = "graphname";
std::cout << "name: " << g[e].name << std::endl;
typedef subgraph
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:32: error: 'struct edgeStruct' has no member named 'name' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:34: error: 'struct edgeStruct' has no member named 'name' /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp: At global scope: /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp: In instantiation of `boost::subgraph
': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:39: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:249: error: incomplete type `boost::STATIC_ASSERTION_FAILURE<0u>' used in nested name specifier /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/pending/detail/property.hpp: In instantiation of `boost::detail::build_property_tag_value_alist<graphStruct>': /home/tcma/cpp/boost_1_32_0/boost/pending/property.hpp:63: instantiated from `boost::property_value ' /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:235: instantiated from `boost::graph_property ' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:40: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:94: error: no type named `next_type' in `struct graphStruct' /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:95: error: no type named `value_type' in `struct graphStruct' /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:96: error: no type named `tag_type' in `struct graphStruct' /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:97: error: no type named `next_type' in `struct graphStruct' /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:98: error: no type named `tag_type' in `struct graphStruct' /home/tcma/cpp/boost_1_32_0/boost/pending/property.hpp: In instantiation of `boost::property_value ': /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:235: instantiated from `boost::graph_property ' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:40: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/pending/property.hpp:63: error: no type named `type' in `struct boost::detail::build_property_tag_value_alist<graphStruct>' /home/tcma/cpp/boost_1_32_0/boost/pending/property.hpp:64: error: no type named `type' in `struct boost::detail::build_property_tag_value_alist<graphStruct>' /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp: In instantiation of `boost::graph_property ': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:40: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/properties.hpp:235: error: no type named `type' in `struct boost::property_value ' /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp: In function `int main()': /home/tcma/cpp/boosttcma/libs/graph/graph_property.cpp:40: 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:42: 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:39: instantiated from here /home/tcma/cpp/boost_1_32_0/boost/graph/subgraph.hpp:106: error: no matching function for call to `boost::detail::error_property_not_found::error_property_not_found(int)' /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:21: note: candidates are: boost::detail::error_property_not_found::error_property_not_found() /home/tcma/cpp/boost_1_32_0/boost/pending/detail/property.hpp:21: note: boost::detail::error_property_not_found::error_property_not_found(const boost::detail::error_property_not_found&) 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 for lack of graph_property.o... ...skipped /home/tcma/cpp/boosttcma/libs/graph/graph_property.run for lack of /home/tcma/cpp/boosttcma/libs/graph/graph_property... ...failed updating 1 target... ...skipped 3 targets...
Date: Mon, 22 Nov 2004 20:36:07 -0500 From: Doug Gregor
Subject: Re: [Boost-users] newbie: Graph library - bundled properties
To: boost-users@lists.boost.org Message-ID:
<0BEF9B5F-3CF0-11D9-84DF-000D932B7224@cs.indiana.edu>
Content-Type: text/plain; charset=US-ASCII;
format=flowed
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
______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca