Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

1

23.04.2006, 18:45

Problem mit der SDL - Kapitel 12

Hallo,

Ich versuche gerade das Spiel aus Kapitel 12 zum laufen zu kriegen (verwende Eclipse unter WinXP) und habe folgende Fehlermeldungen in der Console bekommen:
(Ich poste sie nur in Ausschnitten)

Zitat


D:/Projekte/SDL-1.2.8/include/SDL_audio.h:97: parse error before `[' token
../Game.cpp: In member function `void CGame::ProcessEvents()':
../Game.cpp:149: warning: enumeration value `SDLK_UNKNOWN' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_FIRST' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_BACKSPACE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_TAB' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_CLEAR' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_RETURN' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_PAUSE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_SPACE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_EXCLAIM' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_QUOTEDBL' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_HASH' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_DOLLAR' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_AMPERSAND' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_QUOTE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_LEFTPAREN' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_RIGHTPAREN' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_ASTERISK' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_PLUS' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_COMMA' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_MINUS' not handled in switch


...


D:/Projekte/SDL-1.2.8/include/SDL_audio.h:97: parse error before `[' token
make: *** [Sprite.o] Error 1
Building file: ../Timer.cpp
Invoking: GCC C++ Compiler
g++ -ID:\Projekte\SDL-1.2.8\include -O0 -g3 -Wall -c -fmessage-length=0 -oTimer.o ../Timer.cpp
In file included from D:/Projekte/SDL-1.2.8/include/SDL.h:39,
from ../Timer.hpp:4,
from ../Timer.cpp:1:
D:/Projekte/SDL-1.2.8/include/SDL_audio.h:97: parse error before `[' token
make: *** [Timer.o] Error 1
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -ID:\Projekte\SDL-1.2.8\include -O0 -g3 -Wall -c -fmessage-length=0 -omain.o ../main.cpp
In file included from D:/Projekte/SDL-1.2.8/include/SDL.h:39,
from ../Timer.hpp:4,
from ../Framework.hpp:6,
from ../main.cpp:1:
D:/Projekte/SDL-1.2.8/include/SDL_audio.h:97: parse error before `[' token
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project SDL_Game



Durch googlen habe ich herausgefunden, dass dieses Problem durch loeschen einer Zeile in SDL_audio.h behoben werden kann:

http://www.devolution.com/pipermail/sdl/2005-January/066615.html

Hab ich dann auch gemacht und bekomme prompt wieder Fehlermeldungen en masse:

Zitat


g++ -ID:\Projekte\SDL-1.2.8\include -O0 -g3 -Wall -c -fmessage-length=0 -oGame.o ../Game.cpp
../Game.cpp: In member function `void CGame::ProcessEvents()':
../Game.cpp:149: warning: enumeration value `SDLK_UNKNOWN' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_FIRST' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_BACKSPACE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_TAB' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_CLEAR' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_RETURN' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_PAUSE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_SPACE' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_EXCLAIM' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_QUOTEDBL' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_HASH' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_DOLLAR' not handled in switch
../Game.cpp:149: warning: enumeration value `SDLK_AMPERSAND' not handled in switch

...


blablabla

...


./Framework.o(.text+0x1f3): In function `ZN10CFramework4QuitEv':
D:/Projekte/SDL_Game/Debug/../Framework.cpp:61: undefined reference to `SDL_Quit'
./Framework.o(.text+0x218): In function `ZN10CFramework6UpdateEv':
D:/Projekte/SDL_Game/Debug/../Framework.cpp:76: undefined reference to `SDL_PumpEvents'
./Framework.o(.text+0x254): In function `ZN10CFramework5ClearEv':
D:/Projekte/SDL_Game/Debug/../Framework.cpp:100: undefined reference to `SDL_MapRGB'
./Framework.o(.text+0x265):D:/Projekte/SDL_Game/Debug/../Framework.cpp:100: undefined reference to `SDL_FillRect'
./Framework.o(.text+0x27e): In function `ZN10CFramework4FlipEv':
D:/Projekte/SDL_Game/Debug/../Framework.cpp:113: undefined reference to `SDL_Flip'
./Game.o(.text+0x7ec): In function `ZN5CGame13ProcessEventsEv':
D:/Projekte/SDL_Game/Debug/../Game.cpp:126: undefined reference to `SDL_PollEvent'
./Sprite.o(.text+0x60): In function `ZN7CSpriteD2Ev':
D:/Projekte/SDL_Game/Debug/../Sprite.cpp:22: undefined reference to `SDL_FreeSurface'
./Sprite.o(.text+0x7a): In function `ZN7CSpriteD1Ev':
D:/Projekte/SDL_Game/Debug/../Sprite.cpp:22: undefined reference to `SDL_FreeSurface'
./Sprite.o(.text+0xd2): In function `ZN7CSprite4LoadESs':
D:/Projekte/SDL_Game/Debug/../Sprite.cpp:34: undefined reference to `SDL_RWFromFile'
./Sprite.o(.text+0xdb):D:/Projekte/SDL_Game/Debug/../Sprite.cpp:34: undefined reference to `SDL_LoadBMP_RW'
./Sprite.o(.text+0x146):D:/Projekte/SDL_Game/Debug/../Sprite.cpp:41: undefined reference to `SDL_GetError'
./Sprite.o(.text+0x31f): In function `ZN7CSprite11SetColorKeyEiii':
D:/Projekte/SDL_Game/Debug/../Sprite.cpp:87: undefined reference to `SDL_MapRGB'
./Sprite.o(.text+0x333):D:/Projekte/SDL_Game/Debug/../Sprite.cpp:87: undefined reference to `SDL_SetColorKey'
./Sprite.o(.text+0x399): In function `ZN7CSprite6RenderEv':
D:/Projekte/SDL_Game/Debug/../Sprite.cpp:113: undefined reference to `SDL_UpperBlit'
./Sprite.o(.text+0x42b): In function `ZN7CSprite6RenderEf':
D:/Projekte/SDL_Game/Debug/../Sprite.cpp:138: undefined reference to `SDL_UpperBlit'
./Timer.o(.text+0x66): In function `ZN6CTimerC2Ev':
D:/Projekte/SDL_Game/Debug/../Timer.cpp:11: undefined reference to `SDL_GetTicks'
./Timer.o(.text+0x14e): In function `ZN6CTimerC1Ev':
D:/Projekte/SDL_Game/Debug/../Timer.cpp:11: undefined reference to `SDL_GetTicks'
./Timer.o(.text+0x1df): In function `ZN6CTimer6UpdateEv':
D:/Projekte/SDL_Game/Debug/../Timer.cpp:24: undefined reference to `SDL_GetTicks'
c:/Programme/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libmingw32.a(main.o)(.text+0x97):main.c: undefined reference to `WinMain@16'
make: *** [SDL_Game.exe] Error 1
make: Target `all' not remade because of errors.
Build complete for project SDL_Game


Any ideas?

2

23.04.2006, 19:01

Naja, ich bin zwar erst bei ca. Kapitel 5 oder 6 weiss ich net genau ^^
ABER:
es sieht für mich so aus als hättest du vergessen irgendetwas zu includen.
Gruß

kalo

--------------------------------------------------------------
Wichtig:
Das Krümmelmonster darf aus Gesundheitsgründen nurnoch Gemüse essen.

3

23.04.2006, 19:40

Du musst die *.lib Dateien unter den Projekteinstellungen einfügen. Hast du das gemacht?

4

23.04.2006, 20:12

Im Prinzip schon, ich weiss nicht ob ich sie an der richtigen Stelle eingefuegt habe?

Hier mal ein Screenshot:

http://www.onlinepictures.de/2/uploads/lib2ff29783JPG.jpg

5

23.04.2006, 20:51

Jetzt wirds zu hoch für mcih ^^.
Guck am besten ins buch :) Da müsste das doch stehen irgendwann
Gruß

kalo

--------------------------------------------------------------
Wichtig:
Das Krümmelmonster darf aus Gesundheitsgründen nurnoch Gemüse essen.

6

23.04.2006, 21:02

Da stehts leider nur fuer Visual C++ 6.0 und Visual C++ .net 2003.

7

23.04.2006, 21:24

Schau mal, ob du im oberen Feld noch die Libs sdl.lib und sdlmain.lib einfügen kannst. Ich kenn mich mit dem Compiler nicht so gut aus.

Alternativ kannst du auch in den Dateien, in denen die Libs benötigt werden, folgendes einfügen:

C-/C++-Quelltext

1
2
#pragma comment(lib, "sdl.lib")
#pragma comment(lib, "sdlmain.lib")


Das hat den Vorteil, dass man nicht für den Debug und den release Modus jedesmal die Dateien von neuem einfügen muss.

8

23.04.2006, 21:40

Wenn ich im oberen Feld die .libs einfuege kriege ich die ganze Latte von warning: enumeration value "`SDLK_UNKNOWN' not handled in switch" + das hier:

Zitat


make -k all
Building file: ../Framework.cpp
Invoking: GCC C++ Compiler
g++ -ID:\Projekte\SDL-1.2.8\include -O0 -g3 -Wall -c -fmessage-length=0 -oFramework.o ../Framework.cpp
Finished building: ../Framework.cpp

Building target: SDL_Game.exe
Invoking: GCC C++ Linker
g++ -LD:\Projekte\SDL-1.2.8\lib -oSDL_Game.exe ./Asteroid.o ./Framework.o ./Game.o ./Player.o ./Shot.o ./Sprite.o ./Timer.o ./main.o -lSDL -lSDLmain
Warning: .drectve `%.*s' unrecognized
D:\Projekte\SDL-1.2.8\lib\SDLmain.lib(./Release/SDL_win32_main.obj.b)(.text+0x55):C:\public_cvs\SDL-: undefined reference to `_alloca_probe'
D:\Projekte\SDL-1.2.8\lib\SDLmain.lib(./Release/SDL_win32_main.obj.b)(.text+0x162):C:\public_cvs\SDL-: undefined reference to `_alloca_probe'
D:\Projekte\SDL-1.2.8\lib\SDLmain.lib(./Release/SDL_win32_main.obj.b)(.text+0x1a5):C:\public_cvs\SDL-: undefined reference to `_alloca_probe'
make: *** [SDL_Game.exe] Error 1
make: Target `all' not remade because of errors.
Build complete for project SDL_Game


Wenn ich das #pragma comment verwende, spuckt er interressanteweise noch das hier aus:

Zitat


../Framework.cpp:1: warning: ignoring #pragma comment
../Framework.cpp:2: warning: ignoring #pragma comment


Hey, warum ignoriert der einfach meinen Code?

9

23.04.2006, 21:55

Hmm, jetzt kann ich dir auch nicht mehr weiterhelfen, aber wie wärs, wenn du mal Visual C++ Express installierst. Ich habs auch und bei mir geht alles einwandfrei.

10

23.04.2006, 22:10

Eigentlich ungern...

Aber in der Not frisst der Teufel Fliegen.

Werbeanzeige