well look at a project like this :
* a program
OR
* a static/dynamic library providing functionality to reuse in different programs
* ...
Let's focus on the "program" : a program will consist out of several files. You could put everything in 1 source file, but that is no really manageable (you could consider this just like having 1 closet in your house, where you put all your stuff [not rally handy right ;-) ] )
So when you have organized your code in different source files, they need to be build together to create the program. When you call the compiler by hand you specify 1 file at a time. Now this is where the project comes in, when CodeBlocks is going to build the project it will compile every source file from the project in turn (calling several times the compiler : 1 call per source file), and then in the end it calls the linker to link all the compiled files together into the program executable.
So why a project :
- clean organization of your code
- you can specify settings on the project which are then applied towards the compiler for all source files (like defines)
One more little info : within a project you can have several 'target's, typical use is : debug and release target. Typically the debug target is not optimized by the compiler and contains debug symbols so you can debug the program.The release target will be optimized (for speed or code size); since you want the thing to run as fast as possible ;-)