Boost logo

Boost Users :

From: Stephen Jackson (stephen.jackson_at_[hidden])
Date: 2004-08-20 18:16:41


adel.essafi wrote:
> hi list
> I am using boost to build a small tool that generate a
> (GRAPHICAL) graph showing dependecies between files ;)
> I donc guess why g++ returns to me this error.
> any input will be helpful
> thanks
> Ps : excuse me. I will copy all the source file and the error.
> you can find it a long.
>

Dick Hadsell has offered you advice about fixing up your included
headers, in particular to resolve the "deprecated or antiquated header"
warning. However, you are left with the error:

> main.cpp: Dans function « int main(int, char**) »:
> main.cpp:67: error: invalid initialization of reference of
> type 'const
> boost::property<vertex_first_name_t, QString,
> boost::no_property>&' from
> expression of type 'size_t'

i.e. you are passing a variable of the wrong type as the first parameter
to add_vertex.

> for ( QStringList::Iterator it = lst.begin(); it !=
> lst.end(); ++it ) {
> boost::graph_traits<MyGraphType>::vertex_descriptor v;
> name[v]=*it;
> add_vertex(v,G);
> cerr << *it << endl;
> filesnum++;
> }
>

Instead try:

   for ( QStringList::Iterator it = lst.begin(); it !=
      lst.end(); ++it ) {
             boost::graph_traits<MyGraphType>::vertex_descriptor v;
             // name[v]=*it; This throws from QString
             property<vertex_first_name_t, QString> p( *it );
             v = add_vertex(p,G);
             cerr << *it << endl;
             filesnum++;
   }

This compiles and runs, but I don't know whether it does what you want ;-)

I hope this helps.

Stephen Jackson

-- 
http://www.scribitur.com

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