I was using classes in my OpenGL program to organize my code better, but ever time I try to compile the code I keep getting the following three errors for ever C++ source file that contains a class in it.
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing ‘;’ before type ‘void’
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: ‘WINGDIAPI’ : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found
I am using VC++ 6.0 (Introduction Version). In my header file I include gl.h,glu.h, glaux.h, and windows.h. When I comment out the include statements for gl.h, glu.h, and glaux.h, the errors go away. I have my WinMain funtion in the program, but that doesn’t seem to take care of the errors. The strangest thing is that whenever i double click on the erros to figure out where they are it keeps taking me to the gl.h file. There is no way that the gl.h file is wrong, but at the same time I can’t figure out what I did wrong.I would REALLY appreciate some help on this topic. Thanks!
This little code gives me the same error:
#ifndef CLASSLOADED
#define CLASSLOADED
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#include <windows.h>
class CClass{
public:
CClass(){};
~CClass(){};
Draw();
}
#endif
// CClass.h
#include “HClass.h”
CClass::CClass(){}
CClass: raw(){
glBegin(GL_LINE_LOOP);
glVertex3f(0.0f,1.0f,2.0f);
glVertex3f(0.0f,2.0f,3.0f);
glVertex3f(1.0f,3.0f,2.0f);
glEnd();
}
CClass::~CClass(){}
//The windows code follows here. To make sure that I wasn’t doing anything wrong, I copied the code from the book OpenGL Game Programming. The windows code works perfect just by itself.
P.S. This isn’t the program I was working on. This is the smallest code that I could write that gave me the errors.