# 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 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 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 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 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 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 on other sites
Visual Studio 2005 Express doesn't install with the Platform SDK. Try installing the latest version. :smile:

##### Share on other sites
I'm not using express.

##### Share on other sites
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 on other sites
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 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 on other sites
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.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627711
• Total Posts
2978761
• ### Similar Content

• I want to make professional java 3d game with server program and database,packet handling for multiplayer and client-server communicating,maps rendering,models,and stuffs Which aspect of java can I learn and where can I learn java Lwjgl OpenGL rendering Like minecraft and world of tanks

• A friend of mine and I are making a 2D game engine as a learning experience and to hopefully build upon the experience in the long run.

-What I'm using:
C++;. Since im learning this language while in college and its one of the popular language to make games with why not.     Visual Studios; Im using a windows so yea.     SDL or GLFW; was thinking about SDL since i do some research on it where it is catching my interest but i hear SDL is a huge package compared to GLFW, so i may do GLFW to start with as learning since i may get overwhelmed with SDL.
-Questions
Knowing what we want in the engine what should our main focus be in terms of learning. File managements, with headers, functions ect. How can i properly manage files with out confusing myself and my friend when sharing code. Alternative to Visual studios: My friend has a mac and cant properly use Vis studios, is there another alternative to it?

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.