R – Visual Studio 2008 with Vista, GLUT projects gives error on runtime

charglutglutcreatewindowopenglvisual-studio-2008

I'm sure that there is nothing wrong with my project. Because I have tried it on my ex computer with visual studio 2005 and windows XP pro, and it works error-free.

I can compile my project. There are no errors in build phase. But when I try to run my project it says "*.exe has stopped working".

Then I ran it on debug mode. I saw that it leads me to a line in glut.h

static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title)
 { 
return __glutCreateWindowWithExit(title, exit); 
}

I really don't understand why it is not working..

I copied glut32.dll to C:\Windows\System32
glut.h to C:\Program Files\Microsoft Visual Studio 9.0\VC\include\GL
and glut32.lib to C:\Program Files\Microsoft Visual Studio 9.0\VC\lib

Best Answer

Did you try turning off DEP (data execution prevention) on your application?
Right click on my computer and go into the virtual memory settings. Under the DEP tab, add your application to the ignore list.
You might need a new glut.h, or to rewrite yours. I.e., a different GLUT library.