Ubuntu error compiling SDL_stdinc.h

Started by
4 comments, last by Aerugo 15 years, 8 months ago
I recently learned SDL for cross-platform development. I learned SDL first on the Windows OS and now that I have some experience in SDL, I decided to try my luck in Linux (Ubuntu to be precise). The simple programs compiled good, even the ones with the extra libraries (image, ttf, mixer) compiled with little problems. I'm using the command-line compiler g++, and he has given me these error compiling my 'login'screen.
Quote:/usr/include/SDL/SDL_types.h:38: error: conflicting declaration ‘SDL_FALSE’ /usr/local/include/SDL/SDL_stdinc.h:81: error: ‘SDL_FALSE’ has a previous declaration as ‘SDL_bool SDL_FALSE’ /usr/include/SDL/SDL_types.h:39: error: conflicting declaration ‘SDL_TRUE’ /usr/local/include/SDL/SDL_stdinc.h:82: error: ‘SDL_TRUE’ has a previous declaration as ‘SDL_bool SDL_TRUE’ /usr/include/SDL/SDL_types.h:40: error: conflicting declaration ‘typedef enum SDL_bool SDL_bool’ /usr/local/include/SDL/SDL_stdinc.h:83: error: ‘SDL_bool’ has a previous declaration as ‘typedef enum SDL_bool SDL_bool’ /usr/include/SDL/SDL_types.h:110: error: conflicting declaration ‘DUMMY_ENUM_VALUE’ /usr/local/include/SDL/SDL_stdinc.h:129: error: ‘DUMMY_ENUM_VALUE’ has a previous declaration as ‘SDL_DUMMY_ENUM DUMMY_ENUM_VALUE’ /usr/include/SDL/SDL_types.h:111: error: conflicting declaration ‘typedef enum SDL_DUMMY_ENUM SDL_DUMMY_ENUM’ /usr/local/include/SDL/SDL_stdinc.h:130: error: ‘SDL_DUMMY_ENUM’ has a previous declaration as ‘typedef enum SDL_DUMMY_ENUM SDL_DUMMY_ENUM’ /usr/include/SDL/SDL_types.h:118: error: expected identifier before numeric constant /usr/include/SDL/SDL_types.h:118: error: expected `}' before numeric constant /usr/include/SDL/SDL_types.h:118: error: expected unqualified-id before numeric constant /usr/include/SDL/SDL_types.h:118: error: expected declaration before ‘}’ token
As it would seem, there are some problems with SDL_stdinc.h, But I have no idea of how to solve this. Thank you in advance. Aerugo
Advertisement
Perhaps you need to upgrade your SDL. Here is my version of SDL_types.h (complete minus the copyright):
/* DEPRECATED */#include "SDL_stdinc.h"


How did you install SDL? With apt-get?
It looks like your SDL headers are in two distinct locations (/usr/include and /usr/local/include). Why? Are you certain that the same version of SDL is present at both locations? I suspect a weird interaction between include directory priority and differing header versions.
SDL version is 1.2, the latest stable one I presumed? But I installed it using Ubuntu's synaptic packet manager.

And ToohrVyk, you might be right, but do you know how I could solve this? Removing one path from the PATH variable maybe?
I would personally:

sudo mv /usr/include/SDL /usr/include/SDL.baksudo ln -s /usr/local/include/SDL /usr/include/SDL


That is, make the /usr/include path be a symlink to the /usr/local/include path. This would avoid all the issues related to finding all the locations where input paths are specified (since it can be done on the command line for g++ using -I regardless of what environment variables you export).
Great! It works! I did have to install SDL_image, SDL_ttf and SDL_mixer again, but that's easy using the synaptic packet manager. Th code compiled perfectly. Thank you.

This topic is closed to new replies.

Advertisement