Cross-Compiling an existing linux SDL-Project on win32 and macos

Hi!

We are developing battletaxi - a multiplayer/networking space-taxi clone with lots of weapons. (will be released/added to libsdl.org/sourceforge soon)

We tried to compile the working linux project on windows and on macos - see my problems below

/***************** MAC OS ******************/
i tried the compiling at a friends g4-notebook with latest macos (i guess it was 10.2) and gcc 3.3
i compiled a helloworld.c (which worked) to check, if compiler is okay

now, if i complile the objects with
gcc -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE=“SDL_tests” -DVERSION=“1.2.7” ?-I.-I. ? ? -g -O2 -I /usr/include/SDL -Dmain=SDL_main -DHAVE_OPENGL -c battletaxi.c
this works fine without errors

in the last step i invoke the linker with
gcc -Wall -v -v -v ?-g -O2 -I/usr/include/SDL -Dmain=SDL_main -DHAVE_OPENGL *.o ?-o battletaxi.mac -L/sw/lib -lSDL -lSDL_mixer -lSDL_image ?-Wl,/usr/lib/libobjc.A.dylib

that gives the following error:

Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
?ld -arch ppc -dynamic -o battletaxi.mac -lcrt1.o -lcrt2.o -L/sw/lib -L/usr/lib/gcc/darwin/3.3 -L/usr/lib/gcc/darwin -L/usr/libexec/gcc/darwin/ppc/3.3/…/…/… background.o battletaxi.o bubble.o drawings.o fonts.o game.o highscore.o hud.o input.o level.o man.o menu.o taxi.o weapons.o -lSDL -lSDL_mixer -lSDL_image /usr/lib/libobjc.A.dylib -lgcc -lSystem |
?c++filt3
ld: Undefined symbols:
_main

i dont know, why gcc doesnt know _main - did i forgot to link some lib, or what ? why did my helloworld.c work ?

/*************** WINDOWS *************/
i use MinGW/MSYS under WXP. I compiled all needed SDL_Libraries, which run just fine. If i modify the source to fix below problems “by hand”, i get a
working w32 .exe file

------ W32-PROBLEM 1
the first big problem is that i have to call SDL_Init() other on windows:
linux: ? ? ? ?tscreen = SDL_SetVideoMode (aw, ah, ad, SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_FULLSCREEN);
windows: tscreen = SDL_SetVideoMode (aw, ah, ad, SDL_ASYNCBLIT|SDL_FULLSCREEN);

i dont get a HWSURFACE on windows - is that usual ?

------ W32-PROBLEM 2
the problem i have at linking is, that SDL_gfx calls produce errors - even i installed the SDL_gfx.dll (plus headers) in the same dir as the other SDL*.dll files
if i have the following lines of code included:
? ? ? ? lineRGBA(ascreen, abubble->x, abubble->y-20, abubble->bubblex+20, abubble->bubbley-40, 0x99, 0x99, 0x99, 0xFF);
? ? ? ? lineRGBA(ascreen, abubble->x+1, abubble->y-20, abubble->bubblex+21, abubble->bubbley-40, 0x99, 0x99, 0x99, 0xFF);
? ? ? ? filledEllipseRGBA(ascreen, abubble->bubblex+20, abubble->bubbley-70, abubble->textwidth/2+15, 30, 0x99, 0x99, 0x99, 0xFF);
and i invoke the compiler the following way:
gcc ?-g -O2 -I/mingw//include/SDL -Dmain=SDL_main -DHAVE_OPENGL ? -o battletaxi.exe *.o -L/mingw//lib -lmingw32 -lSDLmain -lSDL -mwindows -lSDL_mixer -lSDL_image -lSDL_gfx

i get the following error:
bubble.o(.text+0x17a): In function bubbleDraw': C:/winapps/develop/msys/home/Dave/workdir/battletaxi/bubble.c:52: undefined reference to_imp__lineRGBA’
bubble.o(.text+0x1b9):C:/winapps/develop/msys/home/Dave/workdir/battletaxi/bubble.c:53: undefined reference to _imp__lineRGBA' bubble.o(.text+0x1fc):C:/winapps/develop/msys/home/Dave/workdir/battletaxi/bubble.c:54: undefined reference to_imp__filledEllipseRGBA’

if i comment the above lines out, everything compiles fine and a get a working .exe

------ W32-PROBLEM 3
another big problem i have under windows is the fullscreen toggle
if i toggle fullscreen/windowed mode under windows. my program segfaults.
here is my toggle code - which runs fine under linux:
void switchfullscreen (void)
{
? ? ? ? SDL_Surface *tmp = SDL_GetVideoSurface();
? ? ? ? Uint32 flags;
? ? ? ? int x,y,bpp;
? ? ? ? if (tmp)
? ? ? ? {
? ? ? ? ? ? ? ? flags = tmp->flags ^ SDL_FULLSCREEN;
? ? ? ? ? ? ? ? x = tmp->w;
? ? ? ? ? ? ? ? y = tmp->h;
? ? ? ? ? ? ? ? bpp = tmp->format->BitsPerPixel;
? ? ? ? ? ? ? ? SDL_SetVideoMode (x, y, bpp, flags);
? ? ? ? }
}

what do i have to change, so it also works on win32 ?

/*************** GENERAL **************/
wouldnt it be an option to invoke gcc under linux in a way, that he cross-compiles binaries for macos/win32 ? if there is a way, could anyone provide
me with some google search terms for doing so ? i would like to create w32 executables without rebooting - dynamic linking should work cross-plattform,
if the .so/.dll files are installed…