Program.exe has stopped working.... error

Hey all,

I’ve added one line to a working opengl program, here it is:

glGenVertexArrays(1, &pVAO);

then I compile and run the program, and it stops with the error in the subject line:

<program.exe> has stopped working…

Am I missing something?

I already use a sprite class in this program successfully to call this and other functions upon instantiation of sprite classes, that I use to manage my basic little sprite engine that I’ve got going. … so why does this happen, when I’m just trying to add one function call?

I know this is the problem, because I commented out all the other code that I added to the program, AND, as soon as I comment out this one line, the program works fine.

Anybody have any clue why this is the case?

I’m going to wrack my brain on this for a while, until I figure it out, but any help is appreciated.

I have a youtube channel that I make tutorials for opengl, and this was going to be my next video…!

Alright, thanks,


NVM, this is just a glitch, I moved the code down further in the same main() function, and it works fine…

Gotta love Microsoft Visual Studio 2017 (it just updated yesterday too, 5GB worth…).


I posted the video that I was working on, on my youtube channel (yet another shameless plug). See link below.

Gnite all, I’m also about to post another fireworks update if anyone is interested.


You’re missing using your debugger.

If you had built and run a debug build (and Visual Studio, which I see you’re using, has an excellent debugger) you wouldn’t have seen a crash. Instead you would have seen execution stop at the glGenVertexArrays call, you would have been able to inspect the function pointer for glGenVertexArrays, seen that it was NULL, and then known that you were calling glGenVertexArrays too early - probably before creating your GL context or before calling glewInit (if using GLEW).

Nice, thank you. I’ll have to re-create the error, and try that.