Sign in to follow this  
xdye9

OpenGL Trouble with VS express and Open GL

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Visual Studio 2005 Express doesn't install with the Platform SDK. Try installing the latest version. :smile:

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 =/

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
where did you get the gl headers from? this makes a big differece... one very easy way out of this is to use one on the openGL extension loaders for you.. for example if you use GLee, jsut put #include "GLee.h" in your code and GLee automagically does the mess for you (because it includes the necessary windows junk for you IF you are in Windows)...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think I had the exact same problem as you. I know its frustrating. What I did was go to

http://www.xmission.com/~nate/glut.html

put the .dll in I think
C:\WINDOWS\system32 or C:\WINDOWS\system(check the readme to be sure)

then put the .lib in vc libary and the .h in the inlcude directory

then at the top of your code just put

#include

and nothing else. This atleast worked for me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this