I follow along with the LazyFoo SDL2.0 tutorials using Code :: Blocks 13.12. I had no problems connecting and starting SDL2 in VS2010, but with a modified IDE and encountering this error:
winapifamily.h: No such file or directory
I think everything is connected correctly. I pointed the program to my SDL2 include and lib directories.
Buildlog: (an error occurs in the file: .. \ include \ SDL2 \ SDL_platform.h)
=== Build: Debug in SDL2_Setup (compiler: GNU GCC compiler) ===
fatal error: winapifamily.h: no such file or directory
=== Build failed: 1 error, 0 warnings (0 minutes, 0 seconds) ===
This is my first question asking a question here. I did Google for an answer and looked for existing questions / answers here, but couldn't solve the problem. Here is my code.
My code is:
// Using SDL and standard IO #include <SDL.h> #include <stdio.h> // Screen dimension constants 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_GetError: %s\n", SDL_GetError() ); } else { // Create window window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); if( window == NULL ) { printf( "Window could not be created! SDL_GetError: %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; }
c ++ codeblocks sdl sdl -2
user3427293 Mar 17 '14 at 2:36 2014-03-17 02:36
source share