Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VC++ compile errors when including gl.h

Compiling a file that uses OpenGL with Visual C++, when I try to include the gl.h header file I get about 150 unhelpful compile errors:

error C2144: syntax error : 'void' should be preceded by ';'

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C2146: syntax error : missing ';' before identifier 'glAccum'

etc.

like image 879
batty Avatar asked Jan 10 '09 02:01

batty


2 Answers

Just #include <windows.h> before <gl/gl.h> or <gl/glu.h>. It is needed for some types, such as WINGDIAPI and APIENTRY.

like image 200
starmole Avatar answered Nov 10 '22 09:11

starmole


Sounds like you're including a C header inside a C++ project. Try enclosing your include statement inside:

extern "C" {
#include "gl.h"
}
like image 2
Ates Goral Avatar answered Nov 10 '22 08:11

Ates Goral