Boost logo

Boost Users :

From: adel\.essafi (adel.essafi_at_[hidden])
Date: 2004-08-20 05:12:31


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.

#include <qapplication.h>
#include <qdir.h>
#include <qcanvas.h>
#include <iostream.h>
#include <vector.h>
#include <fstream.h>
#include <string.h>
#include <fstream>
#include <string>
#include <iostream>
#include <algorithm>
#include <string>
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/property_map.hpp>
#include <qstring.h>

using namespace std;
using namespace boost;

enum vertex_first_name_t { vertex_first_name };
namespace boost {
  BOOST_INSTALL_PROPERTY(vertex, first_name);
}

template <class EdgeIter, class Graph>
void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G)
{
  // Access the propety acessor type for this graph
  typedef typename property_map<Graph, vertex_first_name_t>
    ::const_type NamePA;
  NamePA name = get(vertex_first_name, G);

  typedef typename boost::property_traits<NamePA>::value_type
NameType;

  NameType src_name, targ_name;

  while (first != last) {
    src_name = boost::get(name, source(*first,G));
    targ_name = boost::get(name, target(*first,G));
    cout << src_name << " owes "
         << targ_name << " some money" << endl;
    ++first;
  }
}

int
main(int argc,char **argv)
{

  // Create the graph, and specify that we will use std::string to
  // store the first name's.
  typedef adjacency_list<vecS, vecS,
directedS,property<vertex_first_name_t, QString> > MyGraphType;
  MyGraphType G;
  property_map<MyGraphType, vertex_first_name_t>::type name=
get(vertex_first_name, G);

  QApplication a( argc, argv );
  QCanvas c;
  QDir dir (".") ;
  int filesnum=0;

  QStringList lst = dir.entryList( "*.cpp; *.h" );
  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++;
  }

 return 0;
}

g++ -o filetree main.cpp -I /usr/lib/qt-3.1/include -L
/usr/lib/qt-3.1/lib -lqt
Dans le fichier inclus à partir de
/usr/include/c++/3.3.2/backward/iostream.h:31,
à partir de main.cpp:4:
/usr/include/c++/3.3.2/backward/backward_warning.h:32:2:
attention : #warning This file includes at least one
deprecated or antiquated header. Please consider using one of
the 32 headers found in section 17.4.1.2 of the C++ standard.
Examples include substituting the <X> header for the <X.h>
header for C++ includes, or <sstream> instead of the
deprecated header <strstream.h>. To disable this warning use
-Wno-deprecated.
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'
/usr/include/boost/graph/detail/adjacency_list.hpp:1916:
error: in passing
argument 1 of `typename Config::vertex_descriptor
boost::add_vertex(typename
Config::vertex_property_type&, boost::vec_adj_list_impl<G, C,
B>&) [with
Graph = boost::adjacency_list<boost::vecS, boost::vecS,
boost::directedS,
boost::property<vertex_first_name_t, QString,
boost::no_property>,
boost::no_property, boost::no_property, boost::listS>, Config =
boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS,
boost::vecS,
boost::directedS, boost::property<vertex_first_name_t, QString,
boost::no_property>, boost::no_property, boost::no_property,
boost::listS>,
boost::vecS, boost::vecS, boost::directedS,
boost::property<vertex_first_name_t, QString,
boost::no_property>,
boost::no_property, boost::no_property, boost::listS>::config,
Base =
boost::directed_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS,

boost::vecS, boost::directedS,
boost::property<vertex_first_name_t, QString,
boost::no_property>, boost::no_property, boost::no_property,
boost::listS>,
boost::vecS, boost::vecS, boost::directedS,
boost::property<vertex_first_name_t, QString,
boost::no_property>,
boost::no_property, boost::no_property, boost::listS>::config>]'
gmake: *** [filetree] Erreur 1
*** échec ***

Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)


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