Hello everyone!
So I took a break from attacking the other programmer's forums with my stupid problems and decided I would attack this one instead :twisted:
Now that I've learnt how to use headers properly , I am having for every new class a new .h file (for the declarations) and a new .cpp (for the definitions). I wrote this class declaration in a .h file:
As you can see, both my functions use parameters of some other structs, "LOAD" and "objcopy" (I know the names do not follow the naming conventions, but who cares for now. I will rename all those later). Now when I come to compile the project (I am using Orwell's dev C++), it throws an error at these 2 lines saying:
![[Image: 8rUw5ng.png]](http://i.imgur.com/8rUw5ng.png)
Now I find that weird because:
1-The report is referring to my functions as "variables or fields".
2-Both the structs (actually, objcopy is the struct when LOAD is a class) have been defined before:
![[Image: mN03PRK.png]](http://i.imgur.com/mN03PRK.png)
![[Image: sn9OBle.png]](http://i.imgur.com/sn9OBle.png)
Everything seems to compile properly when I move all the content of AI.cpp and AI.h into the top, under the headers, of main.cpp. I know that including header files is just like copying and pasting; But this doesn't seem to be the case here :/. So what I doing wrong up there? (I really feel it is going to be something stupid from my side, BUT I CAN"T SEE IT!?!)
Thanks in advance!
Edit: I just noticed that the IDE tries to compile AI.cpp alone as a separate program ??? This seems to be the problem, I guess, and if it is then what am I supposed to do to have the IDE not try to compile AI.cpp?
Edit2: Errrrr, never mind.. I just had to remove some ticks in the project options that allow that file to be compiled.. I should've tried a bit more. Sorry for that.
So I took a break from attacking the other programmer's forums with my stupid problems and decided I would attack this one instead :twisted:
Now that I've learnt how to use headers properly , I am having for every new class a new .h file (for the declarations) and a new .cpp (for the definitions). I wrote this class declaration in a .h file:
C++-Code:
class AI_Stuff{ public: int _current_target; void setTarget(objcopy * objcop, LOAD * LOADED); void playAI(objcopy * objcop, LOAD * LOADED); }; |
As you can see, both my functions use parameters of some other structs, "LOAD" and "objcopy" (I know the names do not follow the naming conventions, but who cares for now. I will rename all those later). Now when I come to compile the project (I am using Orwell's dev C++), it throws an error at these 2 lines saying:
![[Image: 8rUw5ng.png]](http://i.imgur.com/8rUw5ng.png)
Now I find that weird because:
1-The report is referring to my functions as "variables or fields".
2-Both the structs (actually, objcopy is the struct when LOAD is a class) have been defined before:
![[Image: mN03PRK.png]](http://i.imgur.com/mN03PRK.png)
![[Image: sn9OBle.png]](http://i.imgur.com/sn9OBle.png)
Everything seems to compile properly when I move all the content of AI.cpp and AI.h into the top, under the headers, of main.cpp. I know that including header files is just like copying and pasting; But this doesn't seem to be the case here :/. So what I doing wrong up there? (I really feel it is going to be something stupid from my side, BUT I CAN"T SEE IT!?!)
Thanks in advance!
Edit: I just noticed that the IDE tries to compile AI.cpp alone as a separate program ??? This seems to be the problem, I guess, and if it is then what am I supposed to do to have the IDE not try to compile AI.cpp?
Edit2: Errrrr, never mind.. I just had to remove some ticks in the project options that allow that file to be compiled.. I should've tried a bit more. Sorry for that.
![[Image: signature.png]](http://s3.postimg.org/wedqxlk3n/signature.png)
A-Engine: A new beat em up game engine inspired by LF2. Coming soon
A-Engine Dev Blog - Update #8: Timeout