Setting Up Irrlicht Project

In this tutorial, I will guide you step-by-step on how to set up Irrlicht Engine on Code::Blocks so that you can start writing your first 3D game in C/C++ language. Before we start, please make sure that you have installed or downloaded the following programs:

Irrlicht Engine
Code::Blocks with MinGW

Once you have installed Code::Blocks, launch the program and create a new project by calling File->New->Project, like so:

We are not going to use a template for now, so we’ll create an empty project instead:

Now that you have created an empty project, you need to create your first empty source file by going to File->New->Empty file

A window will pop out and ask you whether you want to add the file to your project. Click “Yes” and proceed to save it to your project directory. Make sure that the file type is “C/C++ files”:

Another window will pop out and ask you which target should the file belongs to. In this example, we will tick both options. Occasionally you would want a source file to be included in just a single target but that happens quite rarely.

After that, your file will appear under the “Sources” folder. Double click your source file you just saved (i.e. main.cpp) and it will get launched at the right hand panel.

Now that you have successfully created a working project in Code::Blocks, you need to link your compiler with the Irrlicht Engine so that you can access to its API. In order to do that, go to Project->Build options:

A window will then pop out. Click your project name instead of just “Debug” or “Release” because we are going to adjust the settings that affect both targets. Please do not simply change the project settings unless you know what you are doing. You might not be able to compile your app if you mess the settings up.

In this example, we will change 2 things: the “Linker settings” and “Search directories”. First, go to the “Linker settings” tab and click the “Add” button. A window will pop out and ask you which library file should be included to your project. Normally the library file is located at [irrlicht dir]\lib\Win32-gcc\libIrrlicht.a if you’re running Windows. [irrlicht dir] is the directory where you installed/extracted the Irrlicht Engine.

Now that you have added the library file to your compiler, you will need to link some of the Irrlicht directories to the compiler as well so that it can access to its header files. Click the “Search directories” tab and select the “Add” button under “Compiler” child tab. Add the particular folder which contains all the Irrlicht header files which usually located at [irrlicht dir]\include:

Press the “OK” button and you’re done!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.