|
Boost Users : |
Subject: [Boost-users] Error compiling adjacency_matrix.
From: Gerard Guerrero (gerardguerrero_at_[hidden])
Date: 2009-07-30 10:36:00
Hello everyone,
I'm learning how to use adjacency_matrix to create dense graphs for my image
processing PFC, and I've spent a couple of days stuck with the following
compilation error.
**** Build of configuration Debug for project BGL_proves ****
make all
Building file: ../src/BGL_proves.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/BGL_proves.d"
-MT"src/BGL_proves.d" -o"src/BGL_proves.o" "../src/BGL_proves.cpp"
In file included from /usr/include/c++/4.3/ext/hash_set:64,
from /usr/local/include/boost/graph/adjacency_list.hpp:22,
from ../src/BGL_proves.cpp:12:
/usr/include/c++/4.3/backward/backward_warning.h:33:2: warning: #warning
This file includes at least one deprecated or antiquated header which may be
removed without further notice at a future date. Please use a non-deprecated
interface with equivalent functionality instead. For a listing of
replacement headers and interfaces, consult the file backward_warning.h. To
disable this warning use -Wno-deprecated.
../src/BGL_proves.cpp: In function int main():
../src/BGL_proves.cpp:54: error: no matching function for call to
boost::adjacency_matrix<boost::undirectedS, boost::no_property,
boost::property<boost::edge_weight_t, float, boost::no_property>,
boost::no_property, std::allocator<bool> >::adjacency_matrix(main()::Edge
[21], main()::Edge*, int&, double [21])
/usr/local/include/boost/graph/adjacency_matrix.hpp:599: note: candidates
are: boost::adjacency_matrix<Directed, VertexProperty, EdgeProperty,
GraphProperty, Allocator>::adjacency_matrix(typename std::vector<typename
boost::mpl::if_<typename boost::has_property<typename
boost::detail::retag_property_list<boost::edge_bundle_t,
EdgeProperty>::type>::type, std::pair<bool, typename
boost::detail::retag_property_list<boost::edge_bundle_t,
EdgeProperty>::type>, char>::type, typename Allocator::rebind<typename
boost::mpl::if_<typename boost::has_property<typename
boost::detail::retag_property_list<boost::edge_bundle_t,
EdgeProperty>::type>::type, std::pair<bool, typename
boost::detail::retag_property_list<boost::edge_bundle_t,
EdgeProperty>::type>, char>::type>::other>::size_type) [with Directed =
boost::undirectedS, VertexProperty = boost::no_property, EdgeProperty =
boost::property<boost::edge_weight_t, float, boost::no_property>,
GraphProperty = boost::no_property, Allocator = std::allocator<bool>]
/usr/local/include/boost/graph/adjacency_matrix.hpp:472:
note: boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::property<boost::edge_weight_t, float,
boost::no_property>, boost::no_property, std::allocator<bool>
>::adjacency_matrix(const boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::property<boost::edge_weight_t, float,
boost::no_property>, boost::no_property, std::allocator<bool> >&)
../src/BGL_proves.cpp:23: warning: unused variable noms
make: *** [src/BGL_proves.o] Error 1
The code that leaves this error is the following:
#include <iostream>
#include <boost/config.hpp>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/graph/graph_traits.hpp>
using namespace std;
using namespace boost;
int main() {
//Crear vertexs i enllaços amb estructures fàcils d'utilitzar.
enum imatges_e {A,B,C,D,E,F,G,N};
const char* noms = "ABCDEFG";
typedef std::pair<int, int> Edge;
//Entrem enllaços.
Edge edge_array[] = {
Edge(A,B), Edge(A,C), Edge(A,D), Edge(A,E), Edge(A,F),
Edge(A,G),
Edge(B,C), Edge(B,D), Edge(B,E), Edge(B,F), Edge(B,G),
Edge(C,D), Edge(C,E), Edge(C,F), Edge(C,G),
Edge(D,E), Edge(D,F), Edge(D,G),
Edge(E,F), Edge(E,G),
Edge(F,G)
};
//Entrem pesos dels enllaços.
double weights[] = {
3.87317, 16.6444, 16.6504, 16.5974, 16.556, 16.542,
16.5325, 16.5393, 16.4867, 16.4469, 16.4323,
2.44883, 3.34502, 3.82632, 4.12945,
2.73509, 3.46093, 3.75471,
2.65915, 2.99527,
2.31493
};
int num_edges = sizeof(edge_array) / sizeof(Edge);
typedef adjacency_list<vecS, vecS, undirectedS, no_property,
property<edge_weight_t, float> > ALUGraph;
ALUGraph ug (edge_array, edge_array+num_edges, weights, num_edges);
typedef adjacency_matrix< undirectedS, no_property,
property<edge_weight_t, float> > AMUGraph;
AMUGraph ug2 (edge_array, edge_array + num_edges, num_edges, weights);
Here I'm trying to create two versions of the graph. If I comment the
construction of ug2 everything works fine, but if I leave it
uncommented, the former error is generated.
I've been googling for help but I've found nothing that could help me.
Any help will be welcome!! Thanks in advance.
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