Lazy Foo' Productions

Setting up SDL 2 on Code::Blocks 13.12

Last Updated: Feb 2nd, 2015

1) Start up Code::Blocks and create a new empty project.
new project

2) Go to project properties.
project properties

In the project properties go to build options.
build options

3) In order to compile SDL 2 code, we have to tell the compiler to link against the libraries. Go under Linker Settings and paste


into the other linker options field and click OK.
If you get an error where the linker complains about a bunch of undefined references, it means you messed up this step.

4)Now go download the source for lesson 01. Add the source files inside to your project.

Now build. Now you may get an error saying it can't find SDL.h. For linux, we'll have to include the SDL headers like this:
#include <SDL2/SDL.h>

Now that you have SDL 2 compiling, it time to go onto part 2 of the tutorial.