# 100s of meaningless errors

## Recommended Posts

witash    122
I am new to OpenGL programming in C++, and am TRYING to get started. However when i try to compile my first program, i get a list of 100s of meaningless syntax errors in GL.h. The problem seems to be caused by simply trying to include gl.h. Does anone have any idea what is going on? I am using Visual C++ .NET 2003, if that helps at all.

##### Share on other sites
SiCrane    11839
Include windows.h before gl.h.

##### Share on other sites
witash    122
i did include windows.h before gl.h

##### Share on other sites
Palidine    1315
post the first 10 or so errors.

##### Share on other sites
witash    122
the first few errors are:

error C2144: syntax error : 'void' should be preceded by ';'
error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
error C2146: syntax error : missing ';' before identifier 'glAccum'
error C2182: 'APIENTRY' : illegal use of type 'void'
error C2144: syntax error : 'void' should be preceded by ';'
error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
error C2086: 'int WINGDIAPI' : redefinition
error C2146: syntax error : missing ';' before identifier 'glAlphaFunc'

the rest is all similar stuff (although since there are hundreds of them, I haven't serached very thoroughly)

keep in mind that these are all coming from gl.h, which was provided with the compiler, so obviously these syntax errors aren't "right"

##### Share on other sites
Palidine    1315
hrm.... certainly looks like you're not including windows.h before gl.h. could you post your code?

-me

##### Share on other sites
Durfy    109
Did you include the libraries for OpenGL in your project settings?
-durfy

##### Share on other sites
Driv3MeFar    1080
Quote:
 Original post by DurfyDid you include the libraries for OpenGL in your project settings?-durfy

If that were the problem, the OP would much more likely be seeing linker errors.

##### Share on other sites
witash    122
well, the problem IS actually that i didn't include windows.h before gl.h. I have two cpp files, one I wrote myself and one that i didn't. I was assuming the problem was in MY code, but when I looked at the other one I saw this:

#ifdef _WINDOWS
#include <windows.h>
#endif

#include <gl/gl.h>

i took away the first and third lines, and now it works fine. thanks everyone.

##### Share on other sites
Crypter    748

What defines _WINDOWS? I know Win32 compilent compiliers automatically
pre define _WIN32, so:

#ifdef _WIN32# include <windows.h>#endif#include <gl/gl.h>

Will work just fine on Win32 compilent compiliers.