Passing ** class as an argument

I am trying to declare a method in main.h like this:

void buildGraph(int gNum, Graph** gArray);

      

Where Graph is a class and I am trying to pass a pointer to an array of pointers to Graph objects.

I get an error: "The schedule was not announced". Even though I have #include "graph.h" at the top of the page and I am using the graph class so far, so I know it works.

Any ideas?

0


a source to share


3 answers


Maybe the name Graph is in the namespace? What does this graph.h file say - is it a graph at the top level or inside a namespace statement?



0


a source


You probably have more than one graph.h file on your filesystem and the wrong one is included. If, due to copied copying, delete unnecessary copies, if it is due to a collision with the C ++ standard library or other libraries, you should rename the header files to prevent such conflicts in the future.



+3


a source


A common possibility for this is to include a guard incorrectly in Graph.h, possibly to the left of another header file you are using.

That is, make sure the "#ifndef GRAPH_H" line you should have in Graph.h is indeed what it should be ...

(but actually, without further information answering this question ... difficult).

+1


a source







All Articles