Advertisement

Using SDL with Code::Blocks on Linux

Started by April 12, 2006 08:19 AM
2 comments, last by GameDev.net 18 years, 8 months ago
Hi, I'm running SimplyMEPIS (not sure of the version, but it's only a couple of months old). I used apt-get to install Code::Blocks, which works fine. I then went into Synaptic and downloaded basically everything I would need for an SDL project, all the SDL dev libraries etc. Problem is, whenever I try to run an SDL project in Code::Blocks, I see this:

Switching to target: default
Compiling: main.cpp
g++: `sdl-config: No such file or directory
cc1plus: error: unrecognized command line option "-fcflags`"
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings
My build options are set up with 'sdl-config --cflags' as a compiler option, and 'sdl-config --libs' as a linker option. I've also got /usr/include/SDL/ in my directory path within the build options. I'm not sure what's happening here, and [google] throws up no useful help whatsoever - it's all for Windows. Can anybody help? Thanks in advance.
First things first: Make sure you're using the backtick (`) and not single-quote (') on both sides of your call to sdl-config in the compiler options. Backtick says "take the input from this program call and substitute it".

Next, make sure you actually do have sdl-config: go to the terminal and punch it in and see if anything other than an error comes back.

You should get something like:
[~]% sdl-configUsage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]
Advertisement
I haven't used Code::Blocks, but make sure it can find sdl-config, mine is in /usr/local/bin/sdl-config
My SDL headers are in /usr/local/include/SDL/

If Ravuya's advice doesn't work, you might need to include the path to the directory containing sdl-config as well.
1. Remove 'sdl-config --cflags' as a compiler option.
2. Replace 'sdl-config --libs' as a linker option with -lSDL.

This topic is closed to new replies.

Advertisement