View Full Version : how could the .h file be wrong?

09-15-2000, 11:28 PM
hi, i m completely new to openGL.

when i tried to compile a sample code downloaded from the net, my MS VisualC++ give me error:
--------------------Configuration: e - Win32 Debug--------------------
d:\gl\gl.h(1135) : error C2144: syntax error : missing ';' before type 'void'
d:\gl\gl.h(1135) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
d:\gl\gl.h(1135) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

e.obj - 3 error(s), 0 warning(s)


i didn't modify the file at all, how can the gl.h have syntax error?? i tried doing it with other sample code from the net and got the same result. anyone know whats wrong here?

william ng

09-16-2000, 12:39 AM
When using OpenGL in windows you MUST #include <windows.h> before gl.h
I suspect this is the problem being as WINGDIAPI is defined in windows.h

09-16-2000, 03:36 AM
ya!! it worked! thanks!!

now i got another one, when i try to build it. i got this:
--------------------Configuration: e - Win32 Debug--------------------
LINK : fatal error LNK1104: cannot open file "opengl32.dll"
Error executing link.exe.

e.exe - 1 error(s), 0 warning(s)

i am sure that opengl32.dll is in my windows/system/ .it didn't tell me what is wrong. is there anything i can try???

thank you so much!!

william ng

09-16-2000, 04:33 AM
You are not supposed to add opengl32.dll to your project, try with opengl32.lib instead.

09-16-2000, 04:32 PM
Bob, I have included a DLL in my project (with Borland C++ back then) and without the LIB and have gotten programs to link properly

Is there any reason why it shouldn't work?

09-17-2000, 05:10 AM
Ah, yeah, I apologize, you CAN add a dll file into your project. But maybe I expressed myself a tad wrong. If you add opengl32.dll to your project in the Link-tab under Project->Settings (MSVC 6), you will get this error, because the linker can't find the file, unless you keep the dll-file in your lib-directory. This is the place where you should replace .dll with .lib http://www.opengl.org/discussion_boards/ubb/tongue.gif

09-13-2002, 10:25 PM
I got same problem, and I put the head file like this,
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>
#include <gl\glaux.h>

but when building, it shows error message:
error C2144: syntax error : missing ';' before type 'void'


09-14-2002, 11:28 AM
You dont't say very much but i'd guess there is a undefined identifier near the place VC tells you about the error.

Nice way to celebrate a thread's 2 year anniversary http://www.opengl.org/discussion_boards/ubb/wink.gif.

09-14-2002, 03:17 PM
Thanks for reply. http://www.opengl.org/discussion_boards/ubb/smile.gif

I find answer in another post. The glut.h already include gl.h and glu.h, so I don't need include them again.