OK, so I’m writing a pacmac clone on SDL, and on my
windows laptop it compiles and runs fine.
On my PS2linux box, it can’t link.
Here’s the problem: it comlpains about an undefined
reference to SDL_main. However, my main.cpp file has
int SDL_main(int argc, char** argv)
which I believe is the correct prototype (I don’t
think prototype is the correct word here, but you know
what I mean.
If I change the SDL_main to main and remove the
-lSDLmain flag from the compile options, then it all
works fine, if I leave the option in I get an error
aobut a duplicate definiton of main.
Where am I going wrong? What should the link line of
my Makefile look like? Right now, it’s something
sdlpac: game.o, main.o … some other .o’s
$(LD) -g -lSDLmain
sdl-config --libs -o
sdlpac game.o main.o …
Any ideas? The documentation project just uses main,
which is no use for Win32 stuff. Also, I think it’s a
little strange that sdl-config --libs doesn’t provide
-lSDLmain for me, I had to put that in myself.
Basicaly I’m after the ‘best practice’:
-Should I call my ‘main’ function main() or
-Should I link to libSDLmain.a explicitly?
Any pointers welcome… Also (somewhat OT) is the doc
project still active? Who is the best person to talk
to about helping in this respect, I would love to add
to the SDL guide section, my coding isn’t good enough
to contribute source code to the project so I’d like
PS As I’ve been writing this, I’ve come up with a
solution. I leave the main function as main(), not
SDL_main, and I only link with -lSDLmain on the Win32
box, not on the linux box. Is this ‘best practice’?__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost