
Originally Posted by
c99tutorial
I think you need to post some more information.
1. Does the error also happen when you compile and run an SDL app which does not use winapifamily.h? What happens when you compile and run a minimal SDL2 program which does not use the windows API?
2. Please post the source code of a minimal program which demonstrates the problem you mentioned.
As I don't yet know any of the SDL2 functions I have yet to try a simple program that would not use winapifamily.h. I could look for some source code later today that would fit that.
Here is the code that makes the app fail. Note that I'm no longer sure if winapifamily.h is the problem here. My guess is that it has something to do with some issues with 32 and 64 bit programs. I was thinking I'd restart everything from scratch later today if the problem is not fixed.
Code:
/*This source code copyrighted by Lazy Foo' Productions (2004-2013)
and may not be redistributed without written permission.*/
//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_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;
}
Edit: I should probably also note that the return value given to me after the fuction is -1073741634. Which is why I'm guessing it might be a BIT issue.