[SDL] cross-compiling woes

Paul Pelzl pelzlpj at eecs.umich.edu
Mon Jan 17 19:40:42 PST 2005


I've ported a Linux application over to SDL to make life easier for the
Windows folks who want to use it.  It's a console app that produces
audio.  

I have been able to cross-compile for Win32 using mingw on a Linux host,
linking against the libs provided by the SDL-devel-1.2.8-mingw32.tar.gz
archive from the libsdl website.  However, because the application has
useful console output, I don't want the stdio redirection.  I've used
the instructions provided at http://www.libsdl.org/extras/win32/cross/
to build a fresh libSDL with the --disable-stdio-redirect flag.  But
when I try to link against this library, I get the following error:

/usr/lib/gcc/i586-mingw32msvc/3.4.2/../../../../i586-mingw32msvc/lib/libmingw32.a(main.o)(.text+0xf4):
undefined reference to `_WinMain at 16'
collect2: ld returned 1 exit status

I understand that a similar error message occurs when the linking
command is incomplete or has the wrong ordering, but I don't think
that's the case here.  I am making use of sdl-config to get the right
flags (the makefile is attached to this message).

Any ideas?

Paul


-------------- next part --------------
# barebones whitenoise Makefile for MINGW
# edit to fit your needs

CC = i586-mingw32msvc-gcc
SDLROOT = ../libsdl-mingw
CFLAGS = `$(SDLROOT)/bin/i586-mingw32msvc-sdl-config --cflags` -DWIN32_PLATFORM
LDFLAGS = -static
LIBS = -mconsole -lm `$(SDLROOT)/bin/i586-mingw32msvc-sdl-config --static-libs`

# main targets
all: wnoise.exe

OBJECTS = filter.o plot.o whitenoise.o

wnoise.exe: $(OBJECTS)
	$(CC) -o wnoise.exe $(LDFLAGS) $(OBJECTS) $(LIBS)

clean:
	rm -f wnoise.exe *.o core *~

distclean: clean
	rm -f Makefile configure config.h config.log config.status; 
	rm -rf autom4te.cache

# suffixes
.c.o: 
	$(CC) -c $(CFLAGS) $<



# arch-tag: DO_NOT_CHANGE_5f035054-5461-44d3-a4b8-4f255fe467a2 


More information about the SDL mailing list