C++ – Access violation error when using glut on vista

glutvisual-c++windows-vista

I am new in OpenGL. I am using glut library in VC express edition on vista. I am getting runtime error of "access violation" on the following line

glClear(GL_COLOR_BUFFER_BIT);

Can I avoid this error somehow?

Best Solution

For me setting project properties -> linker -> advanced -> data execution prevention to /NXCOMPAT:NO solved the problem.