I moved from DevC++ to Codeblocks and I've come up with this code when I added a header file.
In DevC++, I'm just including the file by using #include "Engine.h". I searched in google and still I didn't understand it. I have an Engine class in Engine.h and the functions in Engine.cpp. Can anyone explain this to me.
#endif // ENGINE_H_INCLUDED
Are you asking what that Include Guard does?
What do you want explained, exactly? "#ifndef" stands for "if not defined".
Ok I get it now. I thought it's a replacement for the Include file thing. lol. Thanks for the link cpjust.
The hash (#) symbol signifies a "preprocessor directive", which basically they are not apart of the actual program. They are instructions for the compiler. #ifndef xxx tells the compiler only to continue if xxx is not defined (ifndef: if not defined). #define xxx tells the compiler to define xxx (optional value). Then you have your source code. Finally #endif tells the compiler that's the end of the if statement (just like C conditional statements - if, while, for have bracket start and end).
The entire purpose is that the compiler will start out with xxx being undefined, then it will define it, then it won't process everything inbetween (basically the entire header file) again, so there is no duplication. It will do that for all header files like that preventing duplication.
Edit: should have refreshed the tab when I came back to it.