Trouble with VS express and Open GL

Started by
10 comments, last by GameDev.net 17 years, 9 months ago
Ive been reading several forums regarding this error message: ------ Build started: Project: Test, Configuration: Debug Win32 ------ Compiling... CGfxOpenGL.cpp c:\program files\microsoft platform sdk\include\gl\gl.h(1152) : error C2144: syntax error : 'void' should be preceded by ';' c:\program files\microsoft platform sdk\include\gl\gl.h(1152) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft platform sdk\include\gl\gl.h(1152) : error C2146: syntax error : missing ';' before identifier 'glAccum' c:\program files\microsoft platform sdk\include\gl\gl.h(1152) : error C2182: 'APIENTRY' : illegal use of type 'void' ........... Test - 146 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== The solution that ussually works is placing "#include <windows.h>" before any other "#include <gl/gl.h>". In this case Ive done it already as well as double checked my code/installed the platform sdk/linked the librarys correctly, and Im still getting this error message. Im currently trying to learn Open GL from a book and have even used the code from the book's cd to check whether if these errors are due to the compiler or the code. Right now Im stuck and need some help to continue learning. I would really appreciate the help.
Advertisement
I've also just recently installed my operating system (after a little run in with Vista) and for some reason, all my solutions that I've copied over that worked before (compiling wise :-P) just don't work at ALL now. Why would I have to all of a sudden include windows.h? Doesn't make any sense to me - One would think that all I had to have was the solution file and that's it.

Anyone who could shed some light on this would be greatly appreciated - thank you for your time.

Also I've googled everywhere and the common advice is to include <windows.h> in the headers - this seems to work in almost all of my solutions, save a few -

I am using SDL as well and I BELIEVE SDL includes windows.h anyways - I don't know guys I'm confused.

-AfroFire is Brin & Brin is AfroFire
post the code around where you include the windows and opengl headers. It is possible that something is screwed up there. Otherwise, is possible the include files are screwed up. Have you modified them or anything?
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
If you'd look at the gl.h file, you'd notice, that on the line 1152 there is the OpenGL API function forward declaration. It looks like this:
WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);

My guess - you don't have WINGDIAPI defined. Searching the SDK headers - i found this macro defined in WinGDI.h header. Note that after you include this headers, APIENTRY macro might not work just yet. It would be the best, to just include windows.h - it will pull in all required headers.
I feel like I'm screaming for help but have no mouth - Including <Windows.h> is not a fix-all problem in this case as I stated.

However your (Paulius) post has given me another idea, perhaps I havn't installed extra necessary headers I had installed previously unaware.

Perhaps GDI or something, I'm not really a windows coder, so I will continue to look around - this is a problem with a lot of unanswered forum posts so my goal here is to get to a solid explanation for all to see and post it here as solved.

Thank you all for your attention.
-AfroFire is Brin & Brin is AfroFire
Well shortly after posting the last message I found I wasn't placing the windows.h in the appropriate locations, and just opted to include the windows.h near the top of gl header, and all programs work again (with some minor changes (VERY ODD))

However, before I NEVER had to do this and am STILL totally 100% baffled as to why I have to do this again, if anyone needs more information I'd be happy to explain, etc... but please don't do it to just blow smoke, I'm mainly looking for someone here who has had experience with this issue and has resolved it without doing what I've done, don't know if such a person exists though.
-AfroFire is Brin & Brin is AfroFire
Visual Studio 2005 Express doesn't install with the Platform SDK. Try installing the latest version. :smile:
I'm not using express.
-AfroFire is Brin & Brin is AfroFire
Hello, I have several errors like those you have (about 1000).
I'm using VC express 2005, Platform SDK, ClanLib (with SDL). I port a linux application to windows.

I saw that in the headers there is a
#define _WINDOWS_
commented, so I uncommented this to let gl.h from clanlib (SDL) use the
#ifdef WIN32
#include
#endif

It would obviously solve all the matter i have, but it seems that it don't consider the define.

sorry for my engrish =/
Hum, so I
#define _WIN32_
In the clanlib header and it solved all my problems =)
hope it helps to find a solution.

PS: clanlib is a game library using SDL.

This topic is closed to new replies.

Advertisement