A
aaragon
Hello everyone,
I'm trying to run some simple code but for some reason it doesn't work
and I've been staring at it for a long time without a single clue of
what's going on. This is what happens, I have a simple class in a file
named "geom.h". This class has a very simple type definition, as
follows:
// type def for domainGraph
typedef ...... domainGraph;
// Domain class
class Domain
{
// private variables
...
public:
typedef graph_traits<domainGraph>::vertex_iterator vertex_iter;
// constructors
...
// member functions
...
};
Now, I try to instantiate an object of vertex_iter from the
constructor of another class, in file "graph.h" but when I write the
following code within the constructor:
// code for constructor in "graph.h"
....
typedef Domain::vertex_iter viter;
viter vi,vi_end;
....
I have the following compiler message:
graph.h: In constructor 'mVAC::mVAC(Domain&, Chromosome&)':
graph.h:xxx: error: 'vertex_iter' in class 'Domain' does not name a
type
graph.h:xxx: error: 'viter' was not declared in this scope
graph.h:xxx: error: expected `;' before 'vi'
make: *** [gui.o] Error 1
The funny thing is that this works from files other than "graph.h". I
tried to do the same form main.cxx and it works fine. It's as if the
Domain class is not seen from the "graph.h" file. Anyone has any clue
of what is happening here???
Thanks for your help.
a^2
I'm trying to run some simple code but for some reason it doesn't work
and I've been staring at it for a long time without a single clue of
what's going on. This is what happens, I have a simple class in a file
named "geom.h". This class has a very simple type definition, as
follows:
// type def for domainGraph
typedef ...... domainGraph;
// Domain class
class Domain
{
// private variables
...
public:
typedef graph_traits<domainGraph>::vertex_iterator vertex_iter;
// constructors
...
// member functions
...
};
Now, I try to instantiate an object of vertex_iter from the
constructor of another class, in file "graph.h" but when I write the
following code within the constructor:
// code for constructor in "graph.h"
....
typedef Domain::vertex_iter viter;
viter vi,vi_end;
....
I have the following compiler message:
graph.h: In constructor 'mVAC::mVAC(Domain&, Chromosome&)':
graph.h:xxx: error: 'vertex_iter' in class 'Domain' does not name a
type
graph.h:xxx: error: 'viter' was not declared in this scope
graph.h:xxx: error: expected `;' before 'vi'
make: *** [gui.o] Error 1
The funny thing is that this works from files other than "graph.h". I
tried to do the same form main.cxx and it works fine. It's as if the
Domain class is not seen from the "graph.h" file. Anyone has any clue
of what is happening here???
Thanks for your help.
a^2