Author Topic: OpenGL  (Read 4205 times)

0 Members and 1 Guest are viewing this topic.

Offline Kosh

  • A year behind what's funny
  • 210
So at the tail end of summer we have a couple of weeks where we take a (mandatory) CS project class using Visual C++ 6.0 MFCs. I got that part all done, but for the welcome screen I wanted to do a little more by having an OpenGL animation of somekind. I looked at this and it seems similair to what I wanted to do, so I thought I would copy the code (and the Data folder) to a new empty project to play around with it and learn more about how it works. Problem, upon compiling this empty project I get 25 linking errors (24 of which saying I have unresolved externals and one of which saying it can't link). Why is it doing this? Keep in mind I didn't actually make any changes yet since I needed to see if it could execute in a new project.
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 
My guess is that you haven't linked against the opengl libraries.

But please! We're not psychic - post the errors!


(and please, get yourself a better compiler :D )
STRONGTEA. Why can't the x86 be sane?

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Yeah, linker errors are annoying. You've got to figure out how your specific IDE wants you to set stuff up. It's hell.

  

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Haha, nehe. Brings back memories.

Just to find out, you working with GLUT?
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline Kosh

  • A year behind what's funny
  • 210
I included the OpenGL libraries at the beginning of the code. Actually all the code is the same, I didn't change anything, I just copied it to an empty win32 application project. All the linker errors seem to be from gl stuff, which makes no sense to me.
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 
What you've done is to include the headers.
Those headers refer to functions in an external library.
Without knowing more about your setup though, we can't really help you further.
At a minimum, you'll need to link against the windows libraries and opengl32.lib.
STRONGTEA. Why can't the x86 be sane?

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Generally, I used to set the files that I'm linking in a seperate header.h. Also, the order in which you include the headers might cause some errors and the like.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 
Stormkeeper: It's a linker error, not an include error.
Kosh, please post the errors!
STRONGTEA. Why can't the x86 be sane?

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
I know, but I do remember getting a linker error before for including some glut header before a standard windows library. Since he's working with OpenGL, there's a chance he might be working with glut so ...
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline Kosh

  • A year behind what's funny
  • 210
Stormkeeper: It's a linker error, not an include error.
Kosh, please post the errors!

Right here:

--------------------Configuration: opengl practice - Win32 Debug--------------------
Linking...
practice.obj : error LNK2001: unresolved external symbol _auxDIBImageLoadA@4
practice.obj : error LNK2001: unresolved external symbol __imp__glTexImage2D@36
practice.obj : error LNK2001: unresolved external symbol __imp__glTexParameteri@12
practice.obj : error LNK2001: unresolved external symbol __imp__glBindTexture@8
practice.obj : error LNK2001: unresolved external symbol __imp__glGenTextures@8
practice.obj : error LNK2001: unresolved external symbol _gluPerspective@32
practice.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
practice.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
practice.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
practice.obj : error LNK2001: unresolved external symbol __imp__glHint@8
practice.obj : error LNK2001: unresolved external symbol __imp__glBlendFunc@8
practice.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
practice.obj : error LNK2001: unresolved external symbol __imp__glDisable@4
practice.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
practice.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
practice.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
practice.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
practice.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
practice.obj : error LNK2001: unresolved external symbol __imp__glTexCoord2d@16
practice.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
practice.obj : error LNK2001: unresolved external symbol __imp__glColor4f@16
practice.obj : error LNK2001: unresolved external symbol __imp__glClear@4
practice.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
practice.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
practice.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Debug/opengl practice.exe : fatal error LNK1120: 25 unresolved externals
Error executing link.exe.

opengl practice.exe - 26 error(s), 0 warning(s)


Here was my setup, dl the visual c++ version of that program, then copy the source code (not the .cpp file). Then create a new blank win32 application, then create a new source code file. then paste the text. Also copy the Data folder and put in your new project folder, don't change the name or anything. That's what I did.
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 
You're not linking against the opengl32.lib library (which on Win32 loads and uses opengl32.dll)

Under VS2008, you go to the project options and then additional dependencies under the linker settings and add 'opengl32.lib', but since you're using VC6, I'm not sure.
STRONGTEA. Why can't the x86 be sane?

 

Offline Kosh

  • A year behind what's funny
  • 210
Any idea where I can find out?
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 

Offline Kosh

  • A year behind what's funny
  • 210
Ok, I figured it out. Thanks guys. Now to wrestle with animations......
"The reason for this is that the original Fortran got so convoluted and extensive (10's of millions of lines of code) that no-one can actually figure out how it works, there's a massive project going on to decode the original Fortran and write a more modern system, but until then, the UK communication network is actually relying heavily on 35 year old Fortran that nobody understands." - Flipside

Brain I/O error
Replace and press any key

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
T'was a linker error in the end. :p
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!