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
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
||=== Build: Debug in AndroGame (compiler: GNU GCC Compiler) ===| obj\Debug\main.o||In function `SDL_main':| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|9|undefined reference to `SDL_Init'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|12|undefined reference to `SDL_CreateWindow'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|13|undefined reference to `SDL_CreateRenderer'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|14|undefined reference to `SDL_RWFromFile'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|14|undefined reference to `SDL_LoadBMP_RW'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|16|undefined reference to `SDL_CreateTextureFromSurface'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|20|undefined reference to `SDL_WaitEvent'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|29|undefined reference to `SDL_RenderCopy'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|30|undefined reference to `SDL_RenderPresent'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|33|undefined reference to `SDL_DestroyTexture'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|34|undefined reference to `SDL_FreeSurface'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|35|undefined reference to `SDL_DestroyRenderer'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|36|undefined reference to `SDL_DestroyWindow'| C:\Users\jjj\Desktop\Game\AndroGame\main.cpp|37|undefined reference to `SDL_Quit'| c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'| ||=== Build failed: 15 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#include <SDL.h> #include <SDL_image.h> int main(int argc, char ** argv) { bool quit = false; SDL_Event event; SDL_Init(SDL_INIT_VIDEO); SDL_Window * window = SDL_CreateWindow("SDL2 Displaying Image", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0); SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, 0); SDL_Surface * image = SDL_LoadBMP("image.bmp"); SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, image); while (!quit) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: quit = true; break; } SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); } SDL_DestroyTexture(texture); SDL_FreeSurface(image); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); return 0; } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Zitat
SDL2main provides SDL_main(), which is a global entry point for all SDL apps. You are not required/forced to use it, but is presence is based on the variety of the systems SDL supports. Windows uses WinMain(), Linux uses main(), Android needs JNI and some Java to actually use SDL, so SDL_main() makes things a little easier.
Ich würde Dir außerdem VisualStudio statt CodeBlocks an's Herz legen
Und Visual Studio hat die leidige Eigenschaft, sich niemals wieder vollständig vom System entfernen zu lassen, einer der Gründe, wieso ich auch nur noch Code::Blocks nutze.
schon etwas lächeln...Zitat
aber wer für Windows entwickeln will und irgendetwas Anderes als Visual Studio verwendet, der ist imo einfach nur selbst schuld...
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#include <SDL.h> #include <stdio.h> 8) const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main( int argc, char* args[] ) { //The window we'll be rendering to SDL_Window* window = NULL; //The surface contained by the window SDL_Surface* screenSurface = NULL; //Initialize SDL if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); } else { //Create window window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); if( window == NULL ) { printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() ); } else { //Get window surface screenSurface = SDL_GetWindowSurface( window ); //Fill the surface white SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) ); //Update the surface SDL_UpdateWindowSurface( window ); //Wait two seconds SDL_Delay( 2000 ); } } //Destroy window SDL_DestroyWindow( window ); //Quit SDL subsystems SDL_Quit(); return 0; } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Werbeanzeige