Invalid or corrupt .h file?

Started by
17 comments, last by Sneftel 14 years, 1 month ago
I'm building a source code of mine in which I get an unresolved external symbol error for each GL and GLUT function call I make; these errors happen during the Linking process. Figuring it might solve the problem, I added GL.h GLU.h and glut.h into my "Additional Dependencies" option in Microsft Visual C++ 2008. Now I'm getting the following error for all three files, with their respective names (meaning not every error says gl.h) C:\Program Files\Microsoft Visual Studio 9.0\VC\include\GLU.h : fatal error LNK1107: invalid or corrupt file: cannot read at 0x476C Do you think my files are the problem?
Advertisement
No. Header files are not libraries -- they're header files (see here). The "additional dependencies" line is for linking to libraries.

The error you got is a linker error, which indicates that your source code compiled successfully but could not be linked into a final executable. What you want is to add the OpenGL libraries (typically opengl32.lib) to that line, not the header files.
Is there any other opengl library I need to add to the list? That is just the thing, I have OpenGL32.lib (located in VC\lib) on that list and I continue to get the 16 unresolved external symbols.
If you're using GLU functions you'll need to add the library for GLU. Generally it's Glu32.lib. If you're using GLUT functions, you'll need to add the library for GLUT. It's generally called glut32.lib.
Much thanks, that resolves the unresolved externals for GLU and GLUT. Is there any other lib file I need for GL commands, along with OpenGL32.lib? GLU and GLUT errors are gone, however I'm receiving 10 errors for gl functions, for example:

OpenGLtest.obj : error LNK2019: unresolved external symbol __imp__glOrtho@48 referenced in function "void __cdecl ChangeSize(int,int)" (?ChangeSize@@YAXHH@Z)

OpenGLtest.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ChangeSize(int,int)" (?ChangeSize@@YAXHH@Z)
Huh, I thought we went over this already. You downloaded some weird opengl-looking libraries from god-knows-where, and that's not how to go about it. Rather, all you need to do is install the latest version of the Platform SDK which includes them (available here; note that despite the name it supports all Windows versions since XP).
Quote:I thought we went over this already...all you need to do is install the latest version of the Platform SDK

In all fairness, Sneftel, with regard to what "we went over" in the other thread, a search for "platform sdk" or "opengl sdk" on msdn downloads doesn't return useful results. No indication of opengl support is mentioned, so determining which "platform sdk" you intended was difficult at best. The "Visual Studio 2008 SDK" (the next best guess) does not, in fact, have opengl files.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Search your computer or online for opengl32.lib

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Quote:Original post by Buckeye
Quote:I thought we went over this already...all you need to do is install the latest version of the Platform SDK

In all fairness, Sneftel, with regard to what "we went over" in the other thread, a search for "platform sdk" or "opengl sdk" on msdn downloads doesn't return useful results. No indication of opengl support is mentioned, so determining which "platform sdk" you intended was difficult at best. The "Visual Studio 2008 SDK" (the next best guess) does not, in fact, have opengl files.
But in the other thread on the 18th:
Quote:Original post by Kaidan Alenko
Indeed, we are talking about the Windows Platform SDK.
So it seems he figured out what he needed despite his using out-of-date terminology. Also, if you search for just "platform sdk" the third link provides a detailed listing of the different SDKs with a link to the download page. I do concede there might be an issue if you don't believe that the 'platform sdk' contains opengl related things. The SDKs contain a lot of stuff and it isn't always easy to find out if the thing you want is actually in it.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

The other thread didn't fix my problem. I already have the OpenGL32.lib file from the Windows Platform SDK. That is the one I am using to link. SiCrane's advice has fixed 6 of my error messages. I know you're probably irritated I'm asking about it again, I don't appreciate the berating I feel I'm getting.

Back to my unanswered question, is there any other .lib files I'll need to add aside from OpenGL32.lib, GLU.lib, and glut.lib in order for OpenGL to work? There has to be, I'm still getting error messages even with OpenGL32.lib linked.

This topic is closed to new replies.

Advertisement