0
Dynamic Memory Allocation C++
Hello! I have two files in which one of them is included in the other. I have written this: Board[0][1]= new ClassA (true,0,1,*this); yet I get a compiler error saying :"expected type-specifier before 'ClassA'", even though I have declared it in that particular scope.
4 odpowiedzi
0
Any chance of getting more than just the one line of code?
0
James
https://code.sololearn.com/cq07Hj6xEqG8/?ref=app
Please check out only the parts where declaration of class Soldier occurs. Thank you!
0
So you are dealing with a few files. The compiler can't find the type.
1. Make aure you are accessing it in the right scope.
2.Make sure you properly #inluded all your files.
3. Make sure your inclusion guards match.
I can't actually sit down and read through everything at the moment. I will have time a bit later. Those are usually a pretty good place to start.
0
James thank you for taking time to check on my code. The thing that was weird about it is that everything turned out well for the other figures and the soldier figure was the one with the problem concerning the declaration scope even though I did the exact same things that I did for the other figures.