100s of meaningless errors

Started by
8 comments, last by Crypter 16 years, 9 months ago
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.
Advertisement
Include windows.h before gl.h.
i did include windows.h before gl.h
post the first 10 or so errors.
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"
hrm.... certainly looks like you're not including windows.h before gl.h. could you post your code?

-me
Did you include the libraries for OpenGL in your project settings?
-durfy
Quote:Original post by Durfy
Did 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.
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.

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.

This topic is closed to new replies.

Advertisement