Ich versuche dieses Programm
#include <SDL.h>
int main(int argc, char** argv) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindow("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255); // Blau
SDL_Rect rect = {10, 10, 10, 10};
SDL_RenderFillRect(renderer, &rect);
SDL_Rect rect1 = {30, 50, 10, 10};
SDL_RenderFillRect(renderer, &rect1);
SDL_Rect rect2 = {50, 40, 10, 10};
SDL_RenderFillRect(renderer, &rect2);
SDL_RenderPresent(renderer);
SDL_Delay(20000);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
mit dem Befehl
gcc main.c -o main -Iinclude/SDL2 -Llib -lSDL2 -lSDL2main
zu compilen und bekomme den Fehler angezeigt:
d:/programme/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Ich benutze gcc mit MinGW.