It would seem that I'm having a bit of trouble nailing down the scope
of a typedef of the adjacency_list type in a class I'm writing. For
some reason, I keep getting the error "error: 'directed_graph' does
not name a type" when trying to compile the following code using
XCode 2.4 with the boost library installed via DarwinPorts and the
appropriate library and search paths (/opt/local/lib/ and /opt/local/
include/) set.
If someone could help me out with this, I would very much appreciate
it. Thanks for your time!
Gratefully,
a.
/*
* GARN.h
* GA_RuleNetwork
*
* Created by Alec Resnick on 1/8/07.
* Copyright 2007 dror. All rights reserved.
*
*/
#ifndef GRAPH_AUTOMATA_RULE_NETWORK_CLASS_HEADER_FILE
#define GRAPH_AUTOMATA_RULE_NETWORK_CLASS_HEADER_FILE
#include <iostream>
#include <vector>
#include <string>
#include
Hi!
From your code I can assume that directed_graph does not name a type is not the only error you receive.
You write:
typedef adjacency_list
It would seem that I'm having a bit of trouble nailing down the scope of a typedef of the adjacency_list type in a class I'm writing. For some reason, I keep getting the error "error: 'directed_graph' does not name a type" when trying to compile the following code using XCode 2.4 with the boost library installed via DarwinPorts and the appropriate library and search paths (/opt/local/lib/ and /opt/local/ include/) set.
If someone could help me out with this, I would very much appreciate it. Thanks for your time!
Gratefully, a.
/* * GARN.h * GA_RuleNetwork * * Created by Alec Resnick on 1/8/07. * Copyright 2007 dror. All rights reserved. * */
#ifndef GRAPH_AUTOMATA_RULE_NETWORK_CLASS_HEADER_FILE #define GRAPH_AUTOMATA_RULE_NETWORK_CLASS_HEADER_FILE
#include <iostream> #include <vector> #include <string> #include
#include #include "GARN_helpers.h" #include "GARN_neighborhood.h"
using namespace std; using namespace boost;
class GARN{ typedef property
edge_property; typedef property vertex_property; typedef adjacency_list directed_graph; typedef graph_traits ::vertex_descriptor vertex; typedef graph_traits ::edge_descriptor edge; private: vector<int> lookupTable; int neighborhoodSize; int numStates; int ruleNumber; directed_graph ruleNetwork; vector
neighborhoodSpace; public: // Constructors------------------------------------------------------------ -> GARN(); GARN(int,int,int);
// Destructors------------------------------------------------------------- -> ~GARN();
// Accessors--------------------------------------------------------------- -> directed_graph get_ruleNetwork();
// Mutators---------------------------------------------------------------- -> };
// Constructors------------------------------------------------------------ -----> GARN::GARN(){
}
GARN::GARN(int _ruleNumber, int _numStates, int _neighborhoodSize){ ruleNumber = _ruleNumber; numStates = _numStates; neighborhoodSize = _neighborhoodSize;
int neighborhoodSpaceSize = int(pow(numStates,neighborhoodSize));
lookupTable = intToNary(ruleNumber, numStates, neighborhoodSpaceSize);
typedef property_map
::type vertex_map; typedef property_map ::type edge_map; vertex_map vertexState = get(vertex_name, ruleNetwork); edge_map edgeState = get(edge_name, ruleNetwork);
vertex parent, child;
for(int i = 0 ; i < neighborhoodSpaceSize; ++i){ parent = add_vertex(ruleNetwork); child = add_vertex(ruleNetwork);
GARN_neighborhood firstGeneration(intToNary (i,numStates,neighborhoodSize)); GARN_neighborhood secondGeneration(firstGeneration.stepTo (lookupTable.at(i)));
vertexState[parent] = firstGeneration; vertexState[child] = secondGeneration; } }
// Destructors------------------------------------------------------------- -----> GARN::~GARN(){
}
// Accessors--------------------------------------------------------------- -----> directed_graph GARN::get_ruleNetwork(){ return ruleNetwork; }
// Mutators---------------------------------------------------------------- -----> #endif
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Alec,
just in case this isn't solved for you yet...
On 1/9/07, Alec Resnick
It would seem that I'm having a bit of trouble nailing down the scope of a typedef of the adjacency_list type in a class I'm writing. For some reason, I keep getting the error "error: 'directed_graph' does not name a type" when trying to compile the following code using XCode 2.4 with the boost library installed via DarwinPorts and the appropriate library and search paths (/opt/local/lib/ and /opt/local/ include/) set. [snip]
directed_graph GARN::get_ruleNetwork(){ return ruleNetwork; }
The error seems to be here. You've missed the scope for your directed_graph type here. I think this should read GARN::directed_graph GARN::get_ruleNerwork(); Cheers, Stephan
participants (3)
-
Alec Resnick
-
Ovanes Markarian
-
Stephan Diederich