PDA

View Full Version : compiling openGL with VC++ STL



guille
12-06-2001, 05:26 AM
Hi!
I have a DLL that compiles perfectly in VC++6 and uses the templates




#include <iostream>
#include <set>
#include <string>

but when I include the following headers




#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include <gl\glaux.h> // Header File For The Glaux Library



I get these errors:

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

Please, does anyone know a solution?
Do I have to include other templates?

Thank you,

guille

Bob
12-06-2001, 05:30 AM
Include windows.h before those files.

guille
12-06-2001, 05:39 AM
Yes, I already did and I got:



c:\program files\microsoft visual studio\vc98\include\winuser.h(2998) : error C2143: syntax error : missing ')' before 'constant'
c:\program files\microsoft visual studio\vc98\include\winuser.h(2998) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft visual studio\vc98\include\winuser.h(2998) : fatal error C1004: unexpected end of file found


And I also tried with winuser.h:



c:\program files\microsoft visual studio\vc98\include\winuser.h(39) : error C2146: syntax error : missing ';' before identifier 'HDWP'
c:\program files\microsoft visual studio\vc98\include\winuser.h(39) : fatal error C1004: unexpected end of file found

RedZen
12-06-2001, 06:14 AM
hmmm, not sure what youre problem is. But if are using STL then you should use the standard namespace.
So after youre header inclusion, add...
using namespace std;
Hope it works man. http://www.opengl.org/discussion_boards/ubb/smile.gif

Bob
12-06-2001, 06:15 AM
Including windows.h before gl/gl.h is all you need to do to get get the OpenGL header included properly. If you get more/other compiler errors, it's because of some other files you use.

Did you, by the way, include winuser.h before windows.h? Should be after, if you need to include it at all.

guille
12-06-2001, 06:24 AM
Yes! You were both right.
I was using the standard namespace.
I have included before afxwin.h and it works.

Thank you for such a quick answer!

[This message has been edited by guille (edited 12-06-2001).]