I am following along with the SDL2.0 tutorials by LazyFoo, using Code::Blocks 13.12. I have had no trouble getting SDL2 linked and running in VS2010 but have changed IDE and come across this error:
winapifamily.h: No such file or directory
I think everything is linked correctly. I have pointed the program to my SDL2 include and lib directories.
Buildlog: (error is occuring in file: ..includeSDL2SDL_platform.h)
=== Build: Debug in SDL2_Setup (compiler: GNU GCC Compiler) ===
fatal error: winapifamily.h: No such file or directory
=== Build fails: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===
This is my first time asking a question on here. I did Google for an answer and search the existing questions/answers on here but was unable to solve the issue. Here is my code also.
My Code:
// 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
", 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
", 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;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…