Search code examples
c++winapiopenglvisual-studio-2005

Error while trying to use OpenGL


I have a very simple C code in which I am trying to use OpenGl. When I include the following files

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <stdlib.h>

I get the following error(and many more but they are similar): C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\GL/gl.h(1152) : error C2144: syntax error : 'void' should be preceded by ';'

but when I include

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <stdlib.h>

I get the following error \mainfile.cpp(4) : fatal error C1083: Cannot open include file: 'GL/glut.h': No such file or directory

any idea what is happening?

I am using XP, VS2005


Solution

  • GLUT isn't part of OpenGL. You need to install it, which is what that error says.