How to compile SDL_bgi programs with CodeBlocks

These instructions show how to compile an SDL_bgi program using CodeBlocks; we will use fern.c, provided in the demo/ directory.

Let’s assume that CodeBlocks is installed in C:\CodeBlocks, and that the SDL2 development libraries for MinGW are installed in C:\SDL2-*. If you installed the software in different directories, change the following instructions accordingly.

The procedure was tested with CodeBlocks 20.03 and SDL2-devel-2.24.2-mingw.tar.gz.

Links:

http://codeblocks.org/

https://libsdl.org/download-2.0.php

Installing SDL_bgi

How to compile

Note 1: if you release your compiled program, you must also provide SDL2.dll and SDL_bgi.dll in the same directory.

Note 2: if your code uses functions provided by stdio.h (e.g. printf(), scanf(), etc.) you must also run a terminal. From the menu "Project/Set program's arguments..., check the box Run host in terminal.

Back to document index