I give up, how do I cross compile, again?

I’m not a Windows user. :slight_smile:

I’ve downloaded Xmingw32-linux-x86-glibc.tar.gz (the Windows cross compiler
package for Linux) and set my $PATH variable to ‘/usr/win32/bin’…

I’m not sure what I have to do to my source code to get it to actually
compile, though!

I assume I need to “#include <windows.h>” in my source file.
But… what can I do to make sure that DOESN’T get attempted when compiling
under Linux? Is there a #define that I can check for (ie, can I do
something like “#ifdef WINDOWS”…"#endif"?)

Also, what’s the deal with “int main(…” vs. “int WINAPI WinMain(…”???

Sorry to be so dumb, but I’ve only ever cross compiled a Win SDL app.
once and it was months and months and months ago!

Thanks!

-bill!

#ifdef linux might do it. But you shouldn’t need to. Look at the
VisualC README - it applies in some parts to this stuff too.

NeilOn Thu, 11 Nov 1999, William Kendrick wrote:

I’m not a Windows user. :slight_smile:

I’ve downloaded Xmingw32-linux-x86-glibc.tar.gz (the Windows cross compiler
package for Linux) and set my $PATH variable to ‘/usr/win32/bin’…

I’m not sure what I have to do to my source code to get it to actually
compile, though!

I assume I need to “#include <windows.h>” in my source file.
But… what can I do to make sure that DOESN’T get attempted when compiling
under Linux? Is there a #define that I can check for (ie, can I do
something like “#ifdef WINDOWS”…"#endif"?)

Also, what’s the deal with “int main(…” vs. “int WINAPI WinMain(…”???

Sorry to be so dumb, but I’ve only ever cross compiled a Win SDL app.
once and it was months and months and months ago!

Thanks!

-bill!

Neil McGill mailto:Neil_McGill *8^) . .
Software Developer:ISDN, Cisco Systems Ltd ~~""~""~"~"|~"~
3rd Floor, 96 Commercial Street, Edinburgh, EH6 6LX, UK ||| |||
Tel: 0131 561 3622 Fax: 0131 561 3601 Mob: 07714 226 281 .:|||||:.:|||||:.

I’m not a Windows user. :slight_smile:

Ok, I’m STILL not a Windows user, but I think I’ve got a Win32 copy of my
game compiled! (My roommate’s still asleep, so I can’t test it on her
Win95 box yet.)

FYI, I added a “win32” target to my Makefile which mangled some makefile
variables.

  • I changed my program’s name to “$(TARGET)”, and had the
    "win32" target change that to include “.exe”…

  • I moved “-lpthread -ldl” into it’s own variable, and when making the
    "win32" target, they get taken out. (I know I’m doing this wrong… :wink: )

  • I added a “-D” define that gets sent to the compiler which will contain
    either the string “LINUX” (by default), or “WIN32” (if building the
    win32 target). In the source, I do a “#ifdef WIN32” to determine how
    I should structure my “main(…)” definition.
    (BTW, I hunted this down by looking at Joe Zbiciak’s Intellivision
    emulator for Linux)

  • And finally, I downloaded the Win32 cross-compiler build of the SDL
    libraries and copied them into “/usr/win32/lib” and had the "win32"
    target tweak the “SDL_PREFIX” that I was using in my makefile before.

FYI, the project that I’m screwing around with is the soon-to-be-released
0.1 version of my “Kaboom!” clone, “Mad Bomber.” I hope it runs as well on
my roommate’s 133Mhz Win95 box as it does on my 450Mhz Linux box! (Yeah,
right!!!)

http://www.newbreedsoftware.com/madbomber/

I’ll also eventually be applying these funky Makefile tweaks (and any
other "Right Way of Doing It"™ suggestions I get from you folks) to
my Linux-themed Defender clone:

http://www.newbreedsoftware.com/defendguin/

BTW, Sam, when’re you gonna list Mad Bomber on the SDL site, eh!? :wink:

-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/bill/

… Eww! I’m building my first Windows app! I feel so… dirty!

#ifdef linux might do it. But you shouldn’t need to. Look at the
VisualC README - it applies in some parts to this stuff too.

Hrmm… I don’t think it would’ve helped too much, except that "main"
bit.

When’s there going to be a super-cool autoconf-style install system for
SDL? (And more importantly, documentation! :wink: )

-bill!

#ifdef linux might do it. But you shouldn’t need to. Look at the
VisualC README - it applies in some parts to this stuff too.

Hrmm… I don’t think it would’ve helped too much, except that "main"
bit.

When’s there going to be a super-cool autoconf-style install system for
SDL? (And more importantly, documentation! :wink: )

There’s already an autoconf in the SDL latest snapshot - I’ve only tried
it under linux. Can you use autoconf under windowz?

You shouldn’t need to add -DWIN32 if you’re reading in windows headers -
in fact, why do you read in the headers at all - isn’t that what SDL lets
you avoid via #include <SDL.h>?

NeilOn Thu, 11 Nov 1999, William Kendrick wrote:

Neil McGill mailto:Neil_McGill *8^) . .
Software Developer:ISDN, Cisco Systems Ltd ~~""~""~"~"|~"~
3rd Floor, 96 Commercial Street, Edinburgh, EH6 6LX, UK ||| |||
Tel: 0131 561 3622 Fax: 0131 561 3601 Mob: 07714 226 281 .:|||||:.:|||||:.

William Kendrick wrote:

When’s there going to be a super-cool autoconf-style install system for
SDL?

SDL-0.11.2 has it.

(And more importantly, documentation! :wink: )

Look in:
/SDL/docs/index.html

		-fjr

You can use autoconf under the cygwin package
(http://sourceware.cygnus.com/cygwin/). I’ve had some problems with it on
win32 because a couple of things in SDL.m4 are broken, etc.

Marcus