Thread: Help my program wont open.

  1. #1
    Registered User
    Join Date
    Jul 2013

    Exclamation Help my program wont open.

    #include "SDL.h"
    #include "SDL_opengl.h"
    #include <iostream>
    #include <string>
    int main(int argc, char* args[])
        //Opengl memory usage
        SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32);
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,1);
        SDL_WM_SetCaption( "My first game", NULL );
        SDL_SetVideoMode(600,400,32, SDL_OPENGL );
        //Use this model
        //not 3d
        std::cout << "OpenGL is running\n";
        std::cout << "Main loop has started\n";
        bool isRunning = true;
        SDL_Event event;
        while ( isRunning )
            while ( SDL_PollEvent(&event) )
                if ( event.type == SDL_QUIT )
                    isRunning = false;
        return 0;

    It is suppose to open as a window but when i run it nothing happens. I see it in task manager as a open process but not window or command prompt open. SDL_Delay and cin.get dont work. Can anyone see my problem? This is my first program in c++. Im usung code blocks with mingw compiler
    Last edited by L337; 07-03-2013 at 11:43 PM.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    Maybe you should start by checking the return values of function calls

    SDL_Init function

    SDL_Init -- Initializes SDL


    int SDL_Init(Uint32 flags);


    Return value


    On error


    On success

    You can get extended error message by calling SDL_GetError. Typical cause of this error is using a particular display without having according subsystem support, such as missing mouse driver when using with framebuffer device. In this case you can either compile SDL without mouse device, or set "SDL_NOMOUSE=1" environment variable before running your application.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jul 2013
    I get a return value of 0, but the process ends immediately.

    Process terminated with status 0(0 minutes, 0 seconds)

    Even with a delay or cin i get the same message.

    Checking for existence: C:\Users\Tomi\Desktop\GAMEDESIGNING\Games\Firstgame\bin\Debug\Firstgame.exe
    Executing: "C:\Users\Tomi\Desktop\GAMEDESIGNING\Games\Firstgame\bin\Debug\Firstgame.exe"  (in C:\Users\Tomi\Desktop\GAMEDESIGNING\Games\Firstgame\.)
    Process terminated with status 0 (0 minutes, 0 seconds)
    Those are the logs i get when i run it.
    Last edited by L337; 07-04-2013 at 11:43 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help, my program wont run!
    By Avocado4Life in forum C Programming
    Replies: 6
    Last Post: 02-09-2011, 05:55 PM
  2. sob.. until now my program wont run...
    By lesrhac03 in forum C Programming
    Replies: 4
    Last Post: 03-31-2008, 11:38 AM
  3. App wont open
    By h_howee in forum Windows Programming
    Replies: 5
    Last Post: 09-06-2006, 04:40 PM
  4. program wont run, always aborts
    By stormfront in forum C Programming
    Replies: 31
    Last Post: 10-31-2005, 05:55 PM
  5. Window Wont Stay Open
    By Wes in forum C++ Programming
    Replies: 4
    Last Post: 08-26-2004, 12:50 AM