< index < 0. Compiling with libtcod | ===================================== 0.2 MINGW32 with Code::Blocks ===================================== |

Use this method if you're using the Code::Blocks IDE on windows.
Obviously, you first have to download and install Code::Blocks. Then start it and click "Create a new project"

#### Create a new project

Choose the "Console application" template, then click Go.
Select your project name and directory and click next.
Select GNU GCC compiler (it's the default) and click next.
Select your language (C or C++) and click Finish.
Your project is created and you can import your sources in <project_name>/Sources.
For this tutorial, we'll use a basic hello world C++ program. You can copy and paste it to replace the main.cpp content created by Code::Blocks :

    #include "libtcod.hpp"

    int main() {
        TCODConsole::initRoot(80,50,"test",false);
        while (! TCODConsole::isWindowClosed()) {
            TCODConsole::root->clear();
            TCODConsole::root->printCenter(40,25,TCOD_BKGND_NONE,"Hello world!");
            TCODConsole::flush();
            TCODConsole::checkForKeypress();
        }
    }

#### Compilation setup

Now right click on the project name in the manager and select "Build options..."
In the "linker settings" tab, add libtcod-mingw.a
In the "search directories" tab, "Compiler" subtab, add the libtcod include directory.
Then click OK.
That's it ! Press CTRL-F9 and your program should compile.

#### Run/Debug configuration

Now if you try to run it (CTRL-F10), it will complain because it doesn't find libtcod-mingw.dll.
To fix this, right click on the project name in the manager and select "Properties..."
In the "Build target" tab, set the Execution working dir to be libtcod directory.
Now CTRL-F10 works and you should see a nice black window with "Hello world!"

#### Remove output window

The MS_DOS window that opens allows you to see the standard output of the program.
For a release version, you probably want to get rid of it.
So once again, right click on the project name, select "Properties...".
In the "Build target" tab, make sure the release target is selected so that you keep the MS-DOS window when you're using the debug version.
In "Type", select "GUI application" instead of "console application".