Nickyu0712 0 Newbie Poster

I just added the allegro and allegroGL packages to my DEV C++ compiler. But I have an error with the set_gfx_mode funtion. I have written this :

#include <allegro.h>
#include <alleggl.h>

int main() {
if (allegro_init() != 0) {
    return 1;
}
if (install_allegro_gl() != 0) {
    return 1;
}

install_keyboard();
install_timer();

allegro_gl_set(AGL_DOUBLEBUFFER, 1);
allegro_gl_set(AGL_WINDOWED, TRUE);
allegro_gl_set(AGL_COLOR_DEPTH, 32);
allegro_gl_set(AGL_SUGGEST, AGL_DOUBLEBUFFER | AGL_WINDOWED | AGL_COLOR_DEPTH);
[B]if(set_gfx_mode(GFX_OPENGL, 640,340, 0, 0))[/B] {
      allegro_message ("Error setting OpenGL graphics  mode:\n%s\n"
      "Allegro GL error : %s\n",
      allegro_error, allegro_gl_error);
      exit(0);
}

allegro_gl_set_allegro_mode();

textout_ex(screen, font, "Hello World!", 50, 100, makecol(255, 0, 0), -1);

allegro_gl_unset_allegro_mode();

allegro_gl_flip();
readkey();

return 0;
}
END_OF_MAIN()

At the the bolded line in the code I get a runtime error : "The instructuin at "0x00000000" referenced memory at "0x00000000". The memory could not be "read"."

What's the problem? And how to solve it?