Building for Windows!

Download the Windows Version!

It took me a while to get there, but I’ve finally gotten a Windows build of the Weirdo in a Weird Land bootstrap project!

My first attempt at building one involved grabbing Visual Studio 10 Express but it really wasn’t meant to be used from the command line… at least not easily…

The successful strategy was to use the Minimalist GNU for Windows toolchain.  This lead to some heartache which began with linker issues… but working with the SDL FAQ, I got things mostly working.  Of all the problems, the most surprising to me was the fact that including libraries in gcc is significant.  Specifically… the following did not work:

$(CC) -o $(BUILDDIR)/$(EXETARGET) $(BUILDDIR)/main.o \
    $(BUILDDIR)/Level.o $(BUILDDIR)/SDLAppMain.o \
    -L$(SDLDIR)/lib -L$(SDLIMAGEDIR)/lib/$(ARCH) \
    -lSDLmain -lSDL -lSDL_image -lmingw32 -mwindows

but THIS did!

$(CC) -o $(BUILDDIR)/$(EXETARGET) $(BUILDDIR)/main.o \
    $(BUILDDIR)/Level.o $(BUILDDIR)/SDLAppMain.o \
    -L$(SDLDIR)/lib -L$(SDLIMAGEDIR)/lib/$(ARCH) \
    -lmingw32 -lSDLmain -lSDL -lSDL_image -mwindows

The significant part here is the -lmingw32 being first.  Without that, I got the following linker issue…

Undefined reference to 'WinMain@16'

Which is discussed in the FAQ… but the answer did not point out that the ordering of the libraries was significant!

Now i just need to create a proper Makefile that will switch easily between the two architectures…. then it’s time to actually write the game!

UPDATE: The original zip that I uploaded seemed to be missing a few necessary files… specifically two DLLs: libgcc_s_dw2-1.dll and libstdc++-6.dll both of which are now part of the distribution.