Click to See Complete Forum and Search --> : Unknown Character "0xf"


Lvl80RetPaladin
January 28th, 2010, 06:39 PM
I'm getting multiple error messages like the thread title when trying to compile an example from the OpenGL Superbible on my Visual C++ 2008. Due to the fact that the code isn't mine (it's a book example) I'm not going to post it on this site.

Apparently the problem is with my OpenGL32.lib file. At first I was getting the "unresolved external symbol" or something like that, so I linked the lib directory as an additional dependency and now I am getting 21 errors like this:

C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\opengl32.lib(3) : error C2018: unknown character '0x1'
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\opengl32.lib(3) : error C2018: unknown character '0x3'
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\opengl32.lib(3) : error C2018: unknown character '0xf'
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\opengl32.lib(3) : error C2018: unknown character '0x1'

What do you think the problem is and how can I fix it? Maybe my IDE isn't set up correctly.. Do I need the files wglext.h and glext.h to run OpenGL? I don't have those in yet.

S_M_A
January 29th, 2010, 03:50 AM
Seems like the lib for some reason is read as text. Are you sure you added it to be linked and not to be compiled?

Lvl80RetPaladin
January 29th, 2010, 04:23 PM
That could be it. What I did to link it was

Project -> (Project name) Properties -> Linker -> General

then copied the file path of the directory with all of the libs in it into the "Additional Library directories" slot, which is

C:\Program Files\Microsoft Visual Studio 9.0\VC\lib

Do you think I linked it wrong?

Edit - also I'm not sure if this is important or not, but I noticed at the top of the list of the 21 errors there is this error:

C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\opengl32.lib(1) : error C2059: syntax error : '<'

From my programming experience the top error is what should be explored first; however seeing as how the error comes from within Opengl32.lib, I'm not sure how to advance.

VladimirF
January 30th, 2010, 12:06 PM
Do you think I linked it wrong?Hard to say - you are not linking anything yet.
What you posted are compiler errors; you fail to compile your code.
Could it be that you "include" that lib file?

Lvl80RetPaladin
January 31st, 2010, 08:37 PM
Sorry for the late reply.

Indeed, that's what I'm doing. I have #include <Opengl32.lib> in my source code. However if I get rid of it I receive ~16 errors of "unresolved external symbol", which I've heard is because Opengl32.lib is not being linked. For example I'm getting

Source1.obj : error LNK2001: unresolved external symbol _glLoadIdentity

What do you mean I am not linking anything yet?

VladimirF
February 1st, 2010, 08:23 PM
Indeed, that's what I'm doing. I have #include <Opengl32.lib> in my source code. However if I get rid of it I receive ~16 errors of "unresolved external symbol", which I've heard is because Opengl32.lib is not being linked. For example I'm getting

Source1.obj : error LNK2001: unresolved external symbol _glLoadIdentityWell, your including of a lib file doesn’t really fix your original 16 errors; it simply creates one error that causes termination of farther compilation.
If your only goal is to reduce the number of error – this is it. You are practically guaranteed to not see any more errors in that project.
What do you mean I am not linking anything yet?Producing an executable file from your code requires (at least) two steps: compile source code into object files and link object files. If compiler fails – you don’t get to link.
Your “unresolved external” errors are in fact linker errors that should be fixed, as you’ve heard, by linking with that lib file.
Read the documentation of you linker on how to do that properly.