(I am still not sure what the #ifnder BURRITO_H and #define BURRITO_H lines do, they came with the Classes template from Code::Blocks) |
These are called include guards. Basically they make it so that the header file can't be included more then once in a program (which would cause problems).
Lets say you have these three files Burrito.h, Taco.h and Chips.h.
Now lets say Taco.h is the first header file to be loaded in your program and Taco.h includes Burrito.h in its file like this.
Taco.h
1 2 3
|
#include "Burrito.h"
// Other stuff below here
|
Then after Taco.h is loaded the next file to load is Chips.h and it also includes Burrito.h like so
Chips.h
1 2 3
|
#include "Burrito.h"
// Other stuff
|
Now if we didn't have header guard on Burrito.h it would try and load the header file twice in the same program which would cause all kinds of errors. But since we did include header guards Taco.h is the first one to be called so it loads the Burrito.h header. Then when Chips.h is called it checks to see if the Burrito.h header is already load and since it is it skips loading it again.
To sum it up always use include guards in your header files and if you want a more in depth reading on the subject you can google it or this thread might help http://stackoverflow.com/questions/8020113/c-include-guards
As for you error code it seems like you are trying to compile a console program as a win32 GUI program.
Since you are on codeblock follow these steps to check and make sure.
1) Click on Project then Properties.
2) Click on the build targets tab.
3) Where it says "type" make sure it says console and not GUI. If it does say GUI change it so that it says console.
4) On the left where it says build targets select release (If you are in debug mode otherwise select debug if you are in release mode) and then repeat steps 1-3.