-Go to "Applications" > "Programming" > "Code::Blocks"
The first time we open Code::Blocks it will ask you which compiler to use, we have to select the GNU GCC compiler:
Now we have the start screen and a tip window will pop up, close the tips window and you will see basically four areas:
- On the left, the current project files (header (.h) and source (.cpp))
- On the right the code from the opened files
- On the top, the menus and the toolbars
- On the bottom, Code::Blocks messages, such as debugger messages, etc.
Select "Empty project" and press "Go"
Just press "Next"
Now write the project name (i have used "Life"), then select where do you want to save it (which folder) and press "Next" again.
Defaults are ok now, press "Next"
We have a new, empty project, let's add the first file, press the new button:
And select "Empty file", then press "Yes" to save the new file
This project is going to have three files:
Finally, we have to tell code::block to include the file in the project, so it can compile and debug them properly, just press ok
Notice now the workspace "Life" has a new folder "headers" inside you will find the new file "engine.h", time to create the other two files and save them:
-Press "New file" > "empty file" > "yes"> write the name (engine.cpp then life.cpp) and "save" , "ok"
Project should look like that now:
Now let's open "Project" > "Build options",In "Linker settings" > "Other linker options" write: -lSDL -lSDL_image, that will make the compiler to link the program against the right libraries (SDL and SDL_image).
Last thing before we start to write down the c++ code:
Save the upper image as "tileset.png" to the "life" directory, other way the project won't work at all.
In the next 3 posts the code for: "engine.h", "engine.cpp" and finally "life.cpp"