More MinGW and MSYS problems

OK, I’m using MinGW and MSYS as the subject suggests,
I’m not sure of versions but if you tell me how to
find them out I’ll tell you what they are.

My SdlPac project is failing at the link stage.

Here are the errors :-------------------------------------------------
Paul at 2P ~/source/SDLPac
$ make
g++ -lstdc++ sdl-config --cflags --libs -lSDL_mixer
-o sdlpac game.o main.o pac.o ghost.o board.o audio2.o
game.o: In function ZN4Game4loopEv': C:/msys/1.0/home/Paul/source/SDLPac/game.cpp:224: undefined reference toSDL_PollEvent’
C:/msys/1.0/home/Paul/source/SDLPac/game.cpp:120:
undefined reference to SDL_PauseAudio' game.o: In functionZN4Game14stateInitIntroEv’:
C:/msys/1.0/home/Paul/source/SDLPac/game.cpp:252:
undefined reference to SDL_RWFromFile' C:/msys/1.0/home/Paul/source/SDLPac/game.cpp:252: undefined reference toSDL_LoadBMP_RW’


followed by many more errors complaining of undefined
references to SDL_somefunctionorother

sdl-config produces this:


$ sdl-config --cflags --libs
-I/usr/local/cross-tools/i386-mingw32msvc/include/SDL
-Dmain=SDL_main
-L/usr/local/cross-tools/i386-mingw32msvc/lib
-lmingw32 -lSDLmain -lSDL -mwindows


The directories specified do exist, and the SDL libs
are all up to date.

MY makefile is this:


TARGET=sdlpac
EDITOR=editor
CC=g++
LD=g++

all: $(TARGET) editor

DEBUG= -DDEBUG -g -Wall -Werror
CFLAGS= sdl-config --cflags $(DEBUG) -O2
LIBS = -lstdc++ sdl-config --cflags --libs
-lSDL_mixer
OBJS = game.o main.o pac.o ghost.o board.o audio2.o
EDITOROBJS = editor.o editormain.o board.o

$(TARGET): $(OBJS)
$(LD) $(LIBS) -o $(TARGET) $(OBJS)

$(EDITOR): $(EDITOROBJS)
$(LD) $(CFLAGS) $(LIBS) -o $(EDITOR)
$(EDITOROBJS)

.cpp.o:
$(CC) $(CFLAGS) -c -o $@ $<

clean:
rm -f $(OBJS) $(TARGET) $(EDITOR)


and I’ve tried mixing up the orders the the libs are
specified by pasting the output of sdl-config into the
Makefile instead of using the `` substitution.

Just for good measure, my main is defined as int
main(int argc, char** argv).

I’m out of ideas here, this all works perfectly
downstairs on my PlayStation2 running Linux…

Thanks in advance for any help, or pointers to obvious
places I’ve forgotten to look…

Paul


Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

OK, I’m using MinGW and MSYS as the subject suggests,
I’m not sure of versions but if you tell me how to
find them out I’ll tell you what they are.

My SdlPac project is failing at the link stage.

Here are the errors :


Paul at 2P ~/source/SDLPac
$ make
g++ -lstdc++ sdl-config --cflags --libs -lSDL_mixer -o sdlpac game.o main.o pac.o ghost.o board.o audio2.o

You need to put the libraries at the end of the link line:
g++ -o sdlpac game.o main.o pac.o ghost.o board.o audio2.o -lstdc++ sdl-config --cflags --libs -lSDL_mixer

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment