Creating an external CS project using Code::Blocks Studio
This tutorial shows you step by step, how you can use Code::Blocks Studio IDE to compile your own CS and CEL applications.
First, you have to configure, build and install (and optionally CEL) using MinGW and MSYS . You have to set the CRYSTAL
enviroment correctly (and CEL, when you use it). Next step is installing Code:.Blocks IDE. When you use Windows, you have to
download the pure IDE without compiler, to avoid problems. So install and run the IDE.
Step1: Setting the correct compiler
Run Code::Blocks. Go to the Build->Compiler settings:
The following window awaits you:
When your default compiler is not GCC, then select form the Selected compiler' list the GNU GCC complier, then click to the Set as default button. Now click to the Programs tab. You can see something, like this:
Now we set up the path of the mingw compiler. To do this, add our installed MinGW/bin path to the Additinal path: So click to this tab:
Now click to the Add button, and select your MinGW/bin directory. on my system, it is the E:/MinGw/bin:
Almost done. Now copy up this path into the Compiler's installation directory edit box:
Step2: Creating the project
Ok, now create a new console project. Click on the New->New project nad select New console project wizard. Check on the do not create any file option. We use the simple1 source to test our work. When done, add to the sources the following files:
You can do it easily by right click on the Console application, and select Add Files.. :
Navigate to your CS/apps/tutorial/simple1/ directory, and add to thep project the files:
Step3: Adding include files
Now we set up the CS include files. Go to the Build->Complier options and click to the include tab. Click to the
Add.. button, and add your CS/include directory.
Step4: Adding libraries
No we add to our project the neccessary library files. We need two at least, libcrystalspace.a for the Crystal Space classes,
the neccessary windows libraries. Go to Build->Compiler options, and click to the Linker tab:
Now click to the Add... button, and add libcrystalspace.lib from your CS\out\msysx86\optimize\libs directory, and libopengl32.a, libgdi32.a, libuser32.a and libkernel32.a from you MinGW/lib directroy. The order does matter so make sure that libcrystalspace.lib is first on the list.
Now press Ctrl+F9, to compile the code. Wait. When you see this message, everything is fine: