The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
using auxiliary SDL libraries with `sdl2-config --cflags --l
tony67


Joined: 27 Mar 2013
Posts: 24
Hi All,
I hope someone can help me out with this. I'm converting code over from SDL 1 to 2. what I have is game source code and a second directory with the graphics code. So my game code is the same whatever graphics I use. So I started to convert from 1 to 2 and at first all went well. However when I started to do things with say sdl mixer or any other aux lib I get errors trying to find the header for mixer. For example in sdl 1 I can in source do
Code:
 i
#include "SDL.h"
#include "SDL_mixer.h"


in makefile I use
Code:

`sdl-config --cflags --libs` -lSDL_mixer

and the config tells the headers to point to the SDL directory.

So when I use sdl 2 I set my source headers as above and in my makefile use
Code:

`sdl2-config --cflags --libs` -lSDL2_mixer


Now when I compile I get "fatal error: SDL_mixer.h: No such file or directory"
So config is making sdl.h point to the sdl2 directory but not "SDL_mixer.h".
I know this as "SDL2/SDL_mixer.h" fixes it.

Am I doing something wrong? I thought the config in make was meant to make all SDL header calls point to the include directories?
Can anyone advise, I can't make all headers "SDL2/ ...." as if I need to build for SDL1 and it will break code. I could do #ifdef's but I'm sure the config should make SDL2 aux headers point to the correct directory as well.

Thanks for the advise Smile
tony67


Joined: 27 Mar 2013
Posts: 24
Hi All
I hope someone can advise me on the following.
From the issue I was having above I thought I would test SDL2 on my laptop ( ubuntu as well ) I installed sdl2 mixer and image. Tried my code and all went great no issues.

So I thought there must be some issue on my desktop, so I deleted the sdl2 directory from usr/include and the usr/lib, also from usr/local as the first attempt at build went there. I then re made sdl2
./configure -prefix=/usr
make clean
make
make install

I can see all the headers in usr/include/sdl2 and all the libs.

Next I went to install image as above, however when I went to try to make I get

SDL_image.h:27:17: fatal error: SDL.h: No such file or directory
compilation terminated.
make: *** [IMG.lo] Error 1


So I'm guessing that the first time I tried to install sdl last week it set some config file that is pointing to /usr/local ?

can anyone advise the correct way to remove so I get rid of the any hidden config files or where I might find them?

Thanks
tony67


Joined: 27 Mar 2013
Posts: 24
Solved it, downloaded gnome search tools which allowed me to find the hard to find files, deleted and rebooted, install worked.