Problem mit dem Linken von SDL



  • Hallo zusammen,

    ich baue ein Testprogramm mit SDL1.3, OpenGL unter Windows statisch zusammen, dieses klappt wunderbar mit folgender Zeile in msys:

    $ gcc main.c -o main.exe -I/usr/local/include/SDL -I/usr/include -Dmain=SDL_main -DHAVE_OPENGL -static -L/usr/local/lib -L/usr/lib -lmingw32 -lSDLmain -lSDL -mwindows -lm -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid -lglew32 -lopengl32

    Wenn ich allerding versuche das Kompilieren und Linken in zwei Befehlsketten zu separieren dann erhalte ich beim Linken Fehlermeldungen und bin nun etwas ratlos.
    Es wäre supernett wenn mir da jemand helfen könnten:
    Kompilieren ok mit:

    $ gcc -I/usr/local/include/SDL -I/usr/include -Dmain=SDL_main -DHAVE_OPENGL -o main.o -c main.c
    

    Linken mit dieser Zeile hier dann nicht mehr:

    $ gcc -static -L/usr/local/lib -L/usr/lib -lmingw32 -lSDLmain -lSDL -mwindows -lm -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid -lglew32 -lopengl32 -o main.exe main.o
    

    Es erscheinen folgende Fehlermeldungen:

    main.o:main.c: (.text+0x7): undefined reference to `SDL_GetError'
    main.o:main.c: (.text+0x23): undefined reference to `SDL_Quit'
    main.o:main.c: (.text+0x3a): undefined reference to `SDL_GetError'
    main.o:main.c: (.text+0x77): undefined reference to `SDL_ClearError'
    main.o:main.c: (.text+0x8b): undefined reference to `SDL_Init'
    main.o:main.c: (.text+0xaf): undefined reference to `SDL_GL_SetAttribute'
    main.o:main.c: (.text+0xc3): undefined reference to `SDL_GL_SetAttribute'
    main.o:main.c: (.text+0xd7): undefined reference to `SDL_GL_SetAttribute'
    main.o:main.c: (.text+0xeb): undefined reference to `SDL_GL_SetAttribute'
    main.o:main.c: (.text+0x11f): undefined reference to `SDL_CreateWindow'
    main.o:main.c: (.text+0x14b): undefined reference to `SDL_GL_CreateContext'
    main.o:main.c: (.text+0x166): undefined reference to `SDL_GL_SetSwapInterval'
    main.o:main.c: (.text+0x18e): undefined reference to `glClearColor@16'
    main.o:main.c: (.text+0x19d): undefined reference to `glClear@4'
    main.o:main.c: (.text+0x1ab): undefined reference to `SDL_GL_SwapWindow'
    main.o:main.c: (.text+0x1b7): undefined reference to `SDL_Delay'
    main.o:main.c: (.text+0x1df): undefined reference to `glClearColor@16'
    main.o:main.c: (.text+0x1ee): undefined reference to `glClear@4'
    main.o:main.c: (.text+0x1fc): undefined reference to `SDL_GL_SwapWindow'
    main.o:main.c: (.text+0x208): undefined reference to `SDL_Delay'
    main.o:main.c: (.text+0x230): undefined reference to `glClearColor@16'
    main.o:main.c: (.text+0x23f): undefined reference to `glClear@4'
    main.o:main.c: (.text+0x24d): undefined reference to `SDL_GL_SwapWindow'
    main.o:main.c: (.text+0x259): undefined reference to `SDL_Delay'
    main.o:main.c: (.text+0x264): undefined reference to `SDL_GL_DeleteContext'
    main.o:main.c: (.text+0x26f): undefined reference to `SDL_DestroyWindow'
    main.o:main.c: (.text+0x274): undefined reference to `SDL_Quit'
    collect2: ld gab 1 als Ende-Status zurück
    

    Da die ganzen Pfade zu den Libs stimmen und auch alle vollzählig sind, bin ich etwas ratlos.

    Wer sieht den Fehler?

    Gruß Chris

    P.S.: Ich musste die Fehlerausgabe abändern da mir die Forensoftware sagte "Maximal sind 10 Smilies erlaubt!"



  • Ich habe den Fehler gefunden, die Reihenfolge der Argumente stimmte nicht. So geht es jetzt:

    $ gcc main.o -o main.exe -static -L/usr/local/lib -L/usr/lib -lmingw32 -SDLmain -lSDL -mwindows -lm -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -version -luuid -lglew32 -lopengl32
    

    Kann also hier geschlossen werden...

    Gruß Chris


Anmelden zum Antworten