Hallo,
habe versucht, die Sourcen von "Ein Spiel mit der SDL" aus Heiko Kallistas Buch "C++ für Spieleprogrammierer" mit Mingw unter Windows (2000) zu übersetzen. Ich habe mir dazu folgendes Makefile geschrieben:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# Makefile to build the sdl game from "C++ für Spielprogrammierer"
#
CC = mingw32-c++.exe
CCFLAGS = -IC:\Spieleprogrammierung\SDL-1.2.8\include -LC:\Spieleprogrammierung\SDL-1.2.8\lib
OBJS = Asteroid.o Framework.o Game.o main.o Player.o Shot.o Sprite.o Timer.o
TARGET = sdlgame.exe
.cpp.o:
$(CC) $(CCFLAGS) -c $*.cpp
$(TARGET): $(OBJS)
$(CC) $(CCFLAGS) $(OBJS) -o sdlgame.exe -lmingw32 -lSDLmain -lSDL -mwindows
|
Wenn ich das dann mit mingw32-make aufrufe, werden die Object-Files korrekt erzeugt, allerdings klappt das Linken nicht; ich kriege folgenden Output:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
|
|| mingw32-c++.exe -IC:\Spieleprogrammierung\SDL-1.2.8\include -LC:\Spieleprogrammierung\SDL-1.2.8\lib Asteroid.o Framework.o Game.o main.o Player.o Shot.o Sprite.o Timer.o -o sdlgame.exe -lmingw32 -lSDLmain -lSDL -mwindows
|| C:\Spieleprogrammierung\SDL-1.2.8\lib/SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_main]+0x0): multiple definition of `main'
|| /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x0): first defined here
|| Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
|| C:\Spieleprogrammierung\SDL-1.2.8\lib/SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_main]+0x55): undefined reference to `_alloca_probe'
|| C:\Spieleprogrammierung\SDL-1.2.8\lib/SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_WinMain@16]+0x162): undefined reference to `_alloca_probe'
|| C:\Spieleprogrammierung\SDL-1.2.8\lib/SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_WinMain@16]+0x1a5): undefined reference to `_alloca_probe'
|| collect2: ld returned 1 exit status
|| mingw32-make: *** [sdlgame.exe] Error 1
|
Ich habe mal danach gesucht: demnach soll man dem Compiler zusätzlich die Optionen "-Dmain=SDL_main" und "-winmm" übergeben, um das zu beheben. Ich habe die dann mal eingefügt, allerdings hat das an der Fehlermeldung nichts geändert. Vielleicht muss man die an einer bestimmten Stelle einfügen?
Kann mir jemand da einen Tipp geben, was da schief läuft?
Für jede Hilfe dankbar
Wolfgang