error including the damn libraries wtf?

Started by
6 comments, last by wing_majin 22 years, 5 months ago
*anger* I can't begin to say how much long i've dealt with this.... I'm trying to make some standard classes for my own use in GL. I write all my classes fine etc etc, nothing complicated as such to induce any errors. However as soon as I include JUST like the pros do in their source (ex NeHe etc) I get a wondeful trio of compiling errors telling me basically that things are either getting redefined or who knows etc etc. This occurs as soon as I include it AND when there's a file in it I downloaded as a tutorial or something that has the EXACT same thing "#include " as my own class..... c:\program files\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void' c:\program files\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers c:\program files\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found (and those errors all occur, supposadly, IN gl/gl.h ) Is there something up with my project settings? Edited by - wing_majin on October 25, 2001 2:02:41 AM
Advertisement
Those errors arent from including the libraries, rather the header files.

Make sure all the lines BEFORE you #include gl/gl.h are correct (ie not missing semi-colons, etc)
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Yeah I''m aware that it''s the file, and although it seems like those are common "human screw up" errors...
#include is the absolute first line in the file
so i figured it might have somethign to do with my settings somwhere im not sure
If the #include ... is in the first line of your header files, maybe that's the cause for the errors. If your #includes are in a header file you wrote yourself, make sure you have an #ifndef ... #define ... #endif construct in your own header files.

Example:
// myheader.h#ifndef _MYHEADER_H_#define _MYHEADER_H_#include <gl/gl.h>#include <gl/glu.h>... declarations ...#endif // #ifndef _MYHEADER_H_// end of myheader.h


baumep

Edited by - baumep on October 25, 2001 2:54:53 AM
baumep
Thanks, but yeah, I know how to write and define classes and all that and im fairly aware of the whole linking process. However, I DO have all that there, but I require the GL in my implementation file "header.cpp", when I include that with a nicely defined class...it gives problems
You need to include windows.h before gl.h

- Pete
What happens is that WINGDIAPI class is undefined, so the when the complier sees
WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);
- the first function prototype in the header file, it doesn''t know what WINGDIAPI is, so you get the error '';'' missing before type ''void''

All you have to do is what siaspete said #include before #include and you''ll be fine.
Thanks that did it. I figured it had something to do with definition here or there but I didn''t think it was that simple to fix

This topic is closed to new replies.

Advertisement