I’m guessing this has more to do with legacy, but I noticed that
SDL and friends have an apparent lack of naming convention which it
comes to #define’ing the fact that they’ve been #include’d:
For example:
SDL.h #defines _SDL_H
SDL_image.h #defines _IMG_h
SDL_ttf.h #defines _SDLttf_h
SDL_mixer.h #defines MIXER_H
Will these change any time soon? I’ve decided to use them to shove out
some user-friendly error messages (using C’s “#error” directive).
In other words, say someone apt-get installs “libsdl1.2”, but forgets to
apt-get install “libsdl1.2-dev”, which contains the header files
(and, I’m guessing, man pages and what-have-you).
Well, when they go to compile an SDL-based program from SOURCE, they’ll
get: “SDL.h: File not found”.
“But wait!”, they cry, “I just installed SDL! Why can’t it find the
headers?”
It’s a pretty FA’dQ, so I decided rather than have to forever deal with
this issue over e-mail, I’d make the process a lot quicker by doing:
#include “SDL.h”
#ifndef _SDH_H
#error “You probably forgot to install the SDL-devel package!”
#endif
Which would cause:
src/file.c:14: SDL.h: No such file or directory
src/file.c:16: #error "You probably forgot to install the SDL-devel package!"
make: *** [obj/file.o] Error 1
Does this sound like a good idea? And will those #defines ever change?
(The part of me that thinks there should be standard naming conventions
hopes so… the part of me that doesn’t want to deal with library
compatibility issues hopes not ;^) )
-bill!–
bill at newbreedsoftware.com Got kids? Get Tux Paint!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/tuxpaint/