Thread: SDL2 Codeblocks error

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    11

    SDL2 Codeblocks error

    Hi!

    Just recently decided to learn SDL2 with C++.

    To begin with I had an bugissue with the winapifamily.h file. Found a boxdrop link with a fix.


    However I can't get the app to start and I'm getting this errormessage:

    "The application was unable to start correctly (0xc00000be). Click OK to close the application."'



    If it's any help i've used the installment guide on lazyfoo.net for Windows with CodeBlocks.


    Thank you in advance!

    / russiancircles

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    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.

  3. #3
    Registered User
    Join Date
    Nov 2013
    Posts
    11
    Quote Originally Posted by c99tutorial View Post
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. no error of compilation but my code makes codeblocks bug
    By funnydarkvador in forum C++ Programming
    Replies: 3
    Last Post: 03-19-2013, 12:31 AM
  2. Need help with codeblocks
    By SilverClif in forum Windows Programming
    Replies: 6
    Last Post: 05-24-2011, 05:12 AM
  3. using codeblocks
    By torquemada in forum Tech Board
    Replies: 7
    Last Post: 04-20-2011, 08:57 PM
  4. error with scanf statement in codeblocks
    By narendrav in forum C Programming
    Replies: 1
    Last Post: 03-19-2011, 11:25 AM
  5. codeblocks compilation error, C Tutorial
    By boarder428 in forum C Programming
    Replies: 8
    Last Post: 09-26-2010, 03:00 PM