Created
April 14, 2012 02:03
-
-
Save Vbitz/2381501 to your computer and use it in GitHub Desktop.
SDL Compile Error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL/SDL.h> | |
| #include <iostream> | |
| #ifdef _WIN32 | |
| #include <windows.h> | |
| #endif | |
| SDL_Surface* DisplaySurface = NULL; | |
| bool Running = true; | |
| void process_event(SDL_Event* event) { | |
| switch(event->type){ | |
| case SDL_QUIT: | |
| Running = false; | |
| break; | |
| default: | |
| break; | |
| } | |
| } | |
| void init_sdl() { | |
| SDL_Init(SDL_INIT_EVERYTHING); | |
| DisplaySurface = SDL_SetVideoMode(1000, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); | |
| } | |
| void init_game() { | |
| } | |
| void draw_game() { | |
| } | |
| void run_game() { | |
| SDL_Event Event; | |
| while (Running) { | |
| while (SDL_PollEvent(&Event)) { | |
| process_event(&Event); | |
| } | |
| draw_game(); | |
| SDL_Flip(DisplaySurface); | |
| } | |
| } | |
| void cleanup_game() { | |
| } | |
| int main(int argc, char** argv) { | |
| init_sdl(); | |
| init_game(); | |
| run_game(); | |
| cleanup_game(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mingw32-g++ -c -D_GNU_SOURCE=1 -Dmain=SDL_main src/main.cpp -o obj/main.o | |
| mingw32-g++ -lmingw32 -lSDLmain -lSDL -mwindows obj/main.o -o bin/game.exe | |
| obj/main.o:main.cpp:(.text+0x4e): undefined reference to `SDL_SetVideoMode' | |
| obj/main.o:main.cpp:(.text+0x7b): undefined reference to `SDL_PollEvent' | |
| obj/main.o:main.cpp:(.text+0x91): undefined reference to `SDL_Flip' | |
| collect2: ld returned 1 exit status | |
| mingw32-make: *** [build] Error 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment