User forums > Using Code::Blocks

Help getting SDL2 to work in Code Blocks

(1/1)

MrBeverage:
I'm new to programming, and very frustrated with IDEs.
I'm running MX Linux (Debian based).
I can compile successfully with: $ gcc -o main main.c `pkg-config --cflags --libs sdl2, SDL2_image`
But how do I configure CodeBlocks use the same command??? (or at least achieve the same result).
I would appreciate some DETAILED help.

stahta01:
1. Setup Code::Blocks toolchain
2. Create empty project
3. Add "`pkg-config --cflags sdl2, SDL2_image`"  to "other compiler options" include the slant quotes do not include the double quotes
4. Add " `pkg-config --libs sdl2, SDL2_image`" to "other linker option" include the slant quotes do not include the double quotes

Remember edit the project options under Project -> Build options

Link to CB Wiki https://wiki.codeblocks.org/index.php/Main_Page

Tim S.

Krice:
Or you can add libraries to Build options - Linker settings:

libSDL2main
libSDL2

Maybe SDL2_Image can be added also there, but at least with plain SDL2 it works like that. On Linux you don't even need to add libraries location, but on Windows you might need to do that for Code::Blocks to find where SDL2 is installed.

Navigation

[0] Message Index

Go to full version