SDL - undifined reference
-
Warum klappt dass hier den nicht? Ich würde gerne aus einem Bild mehrere Frames auslesen, und diese dann ganz schnell hintereinander ablaufen lassen, sodass es eine Animation wird.
Doch es kommen dauernd Fehler mit "undifined reference...".Compiling: H:\C++ Projekte\Con_Bday\main.cpp
Linking console executable: H:\C++ Projekte\Con_Bday\main.exe
H:\C++ Projekte\Con_Bday\main.o:main.cpp:(.text+0x38): undefined reference to\_SDL_Init' H:\\C++ Projekte\\Con\_Bday\\main.o:main.cpp:(.text+0x6d): undefined reference to_SDL_SetVideoMode'
H:\C++ Projekte\Con_Bday\main.o:main.cpp:(.text+0xcf): undefined reference to\_SDL_DisplayFormat' H:\\C++ Projekte\\Con\_Bday\\main.o:main.cpp:(.text+0xdd): undefined reference to_SDL_FreeSurface'
H:\C++ Projekte\Con_Bday\main.o:main.cpp:(.text+0x124): undefined reference to\_SDL_UpperBlit' H:/Programme/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to_WinMain@16'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
6 errors, 0 warningsCODE:
#include "SDL/SDL.h" #include "SDL/SDL_image.h" #include <string> #include <ctime> using namespace std; SDL_Surface * LoadImage(const string &filename); void ApplySurface(short x, short y, SDL_Surface *source, SDL_Surface *destination, SDL_Rect *clip = NULL); int main(int args, char *argc[]) { //Variablen (structs) für Bilder\Events SDL_Surface *screen = NULL; SDL_Surface *image = NULL; SDL_Event event; bool quit = false; short counter = 0; long time1 = time(0); //SDL initialisieren if (SDL_Init(SDL_INIT_EVERYTHING) == -1) return 1; screen = SDL_SetVideoMode(640,480,32,SDL_SWSURFACE); if(screen == NULL) return 1; //Frames festlegen SDL_Rect offset[6]; //frame1 OBERE REIHE offset[0].x = 0; offset[0].y = 0; offset[0].w = 130; offset[0].h = 136; //frame2 offset[1].x = 131; offset[1].y = 0; offset[1].w = 130; offset[1].h = 136; //frame3 offset[2].x = 262; offset[2].y = 0; offset[2].w = 130; offset[2].h = 136; //frame4 offset[3].x = 393; offset[3].y = 0; offset[3].w = 130; offset[3].h = 136; //frame5 UNTERE REIHE offset[4].x = 0; offset[4].y = 137; offset[4].w = 130; offset[4].h = 136; //frame6 offset[5].x = 131; offset[5].y = 137; offset[5].w = 130; offset[5].h = 136; //Frame Bild laden image = LoadImage("cat 131X137.bmp"); //Event Schleife while(quit == false) { if(time(0) > (time1 + 499)) { ++counter; time1 = time(0); } if(counter > 5) counter = 0; //Input überprüfen while(SDL_PollEvent(&event)) { if(event.type == SDL_QUIT) { quit = true; } } //Frames wiedergeben ApplySurface(0,0,image,screen,&offset[counter]); //Bildschirm flippen if(SDL_Flip(screen) == -1) return 1; } SDL_Quit(); return 0; } SDL_Surface * LoadImage(const string &filename) { SDL_Surface *loadedImage = NULL; SDL_Surface *optimizedImage = NULL; loadedImage = IMG_Load(filename.c_str()); if(loadedImage != NULL) { optimizedImage = SDL_DisplayFormat(loadedImage); SDL_FreeSurface(loadedImage); } return optimizedImage; } void ApplySurface(short x, short y, SDL_Surface *source, SDL_Surface *destination, SDL_Rect *clip) { SDL_Rect offset; offset.x = y; offset.y = y; SDL_BlitSurface(source, clip, destination, &offset); }Vll. blickt von euch jemand durch, ich verstehe es gerade leider nicht

MfG
Stromberg
-
Hallo
Hast du alle Bibliotheken gelinkt?
chrische
-
Was meinst du mit linken? Also SDL und SDL-image sind installiert, und haben bei allen anderen Sachen in der letzten Zeit auch immer gefunzt.
MfG
Stromberg
-
Du musst die benötigten Bibliotheken noch zusätzlich einbinden. Bei deinem Compiler gibts sicher irgendwo Linker-Optionen, wo du zusätzliche Eingaben tätigen kannst. Und ansonsten mit
#pragma comment(lib, "dateiname.lib")