Tim Rau wrote:
I’ve been getting this error while trying to compile an SDL appilication.
I do not think it is an SDL error, as I have read and followed two SDL
tutorials to the letter. I have already done as much googling as I can
(an hour and a half), read all the faqs, and searched the forums and my
searches reveal nothing. I have set my Linker options to
-lmingw32 -lSDLmain -lSDL
Assuming you are using Mingw, and assuming you have managed to do
the two tutorials properly, I guess your setup works. However,
there’s no need to fiddle with link options like the above if you
use sdl-config in your Makefiles. Please see the test programs in
your SDL installation and follow how it calls sdl-config to
generate the proper CFLAGS and LDFLAGS options.
without the -lmingw32, it gives “undefined reference to winmain at 16” With
it, it gives “undefined reference to SDL_main” It seems to me that I am
linking against a library with that very name. If you can help me, I’d
much appreciate it.
Here is my(very short) code:
A backslash in a path is an awful thing to feed into gcc… If
this was taught by the tutorials, then they are shockingly bad.
Can you provide the list with the URLs of the tutorials? With
sdl-config, you include the path and use “SDL.h” instead.
sdl-config simplifies a lot of things. sdl-config can also show
you what parameters to use, and you can plug that in if you really
do not want to call sdl-config in your Makefile. For example, you
can run the script on the command line:
$ sdl-config --cflags
-I/usr/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main
$ sdl-config --libs
-L/usr/lib -lmingw32 -lSDLmain -lSDL -mwindows
Since the library settings look similar, your problem may be with
C flags. Use the following in your Makefiles instead:
CFLAGS = $(shell sdl-config --cflags) … blah blah
LDFLAGS = $(shell sdl-config --libs) … blah blah
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia