Image

Setting up Code::Blocks on Windows

Modified: 2008/06/13 10:22 by Caste - Uncategorized
Hey folks,

if you just started reading and didnt know which was the easiest way to get the code written down or if you werent statisfied by your old developement environment this is the right place to start!

I'll just explain what I will do right now (have only installed it on Ubuntu usually), so this is a step-by-step instruction, which worked in June 2008.

Edit

Downloading and Installing

Go to www.codeblocks.org, select Downloads at the top or in the menu, choose Binary Release and click on Download From any of the severs behind codeblocks-8.02mingw-setup.exe (or whatever is the nevest version by then). Its important that you choose the one with MinGW as this is the compiler which will then be used by default. You can use the VS compiler, too, but then installing SDL (next step) will be different.

Now go ahead an install it to your destination of choice.

Edit

Setting up Code::Blocks for SDL

When running Code::Blocks for the first time it asks which compiler we want to use by default. Lets choose GCC (also called MinGW as its a port of GCC). GCC stands for GNU Compiler Collection if anybody wants to know :).

I dont know whether you like Tips at startup, I dont, hehe. Well just select all the standard things for you.

Now you need the SDL libraries. Go to www.libsdl.org/download-1.2.php and get the latest Development Library package for Windows and MinGW. Extract this to some place where you will find it again, as you'll need that for every OpenGL project from NeHe.

Hehey, fun thing is: Code::Blocks has a wizard for creating SDL applications but it does only work if you copy all the files from < PathToSDL >\include\SDL into < PathToSDL >\include. But we're not going to use this way, we will try to get the first NeHe lesson working.

Edit

Compiling a NeHe-Lesson

So now lets use SDL with one of our lessons. Get the first one (Lesson 01 link at the bottom), extract it and open the Code::Blocks project in the win/codeblocks/build folder.

Now you need to tell the project where to find the SDL includes and libs. So right click on the project name, on the right side in the project browser, and choose Build options. Then you should click on the project name left, not only Release or Debug, so your changes apply to the whole project. Now you switch to the tab Search directories and tell Compiler and Linker the path to < PathToSDL >\include and \lib.

You can either place sdl.dll in the folder of each lesson you create (same folder as the .exe) or you can put it into C:\Windows\System32.

That's it, you should be able to compile the lessons now! To understand it go ahead and read Lesson 01!

Edit

Releasing OpenGL & SDL programs

If you're going to release something you've created with the NeHe basecode, you need to ship sdl.dll. Just place it in the same folder as your .exe

© by Caste (NeHe-Team) - June 7 2008

ScrewTurn Wiki version 2.0.27. Some of the icons created by FamFamFam.