My program won't stay open.

I'm trying to write a simple program that basically just outputs a resolution that I gave. I put the while in there to keep it open.. but all it does is flash open and close immediately.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <allegro.h>

int main (void){
    int ret;
    allegro_init();
    install_keyboard();
    ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
    if (ret!=0)
    {
               allegro_message(allegro_error);
                return 1;
                }

	textprintf(screen, font, 0, 0, makecol(255,255, 255), "%dx%d", SCREEN_W, SCREEN_H); 
    while(!key[KEY_ESC])
    allegro_exit();
    return 0;
}
END_OF_MAIN()
It also gives this one error: LINK : fatal error LNK1104: cannot open file 'C:\Users\Seth\Documents\Visual Studio 2005\Projects\initgraphics\Debug\initgraphics.exe'
In the new windows c++, you have to put:

system("pause"); at the end of the program, not return 0
^ No. Read the sticky http://www.cplusplus.com/forum/beginner/1988/
or the article http://www.cplusplus.com/articles/iw6AC542/

@OP: ¿does that file exist? the IDE simply could not execute it, checkout that it is building correctly
Topic archived. No new replies allowed.