Undefined reference to `gluPerspective@32' in beginner example of spinning image

I’ve spent quite a lot of time researching the solution to this problem. It seems related to not referencing the library function correctly ‘o’ or the library dll not being there at all.
After looking it up I think the file -> glu32.dll comes with GLUT but I have freeglut installed, so I don’t know if there is a problem there. I would like to get the project running but not at the expense of having a big mess between two differing opengl collections. It may be just not linking the file correctly in settings. Still - help!

\working_fcode_luna\hello\Debug/…/src/hello.cpp:72: undefined reference to gluPerspective@32 \working_fcode_luna\hello\Debug/../src/hello.cpp:76: undefined reference togluLookAt@72’

Thanks in advance

Two things. First, are you following some sort of tutorial and can you link to it? Can you put your source code somewhere for us to see (gist, pastebin, inline, whatever)? Second, I’m not sure this is related at all to SDL. If this is something more-so with OpenGL, you might have better luck on something like stackoverflow.

To answer some of your question, freeglut does implement everything you need, but it seems like maybe you’re not linking properly. It’s been a while since I’ve done OpenGL, but articles like this and even simpler this stackoverflow question should be able to help you. Otherwise, without knowing more about your project setup (like if you’re using Visual Studio or makefiles, showing your source), I can only make some shots in the dark.

Hi Alex Thank you for the response.

I’ve been following studying SDL2 but also this very basic tutorial to install GLUT : https://w3.cs.jmu.edu/bernstdh/Web/common/help/cpp_mingw-glut-setup.php
I don’t understand this line:

line: Copy glut32.lib to your build directory (i.e., the directory that you compile into and link from).
Where is my build directory?
And this line:
When you link, you must explicitly link-in glut32.lib (and not use the -lglut32 option).
How do I explicitly link instead of -l…I see what the IDE is doing and its not explicit. So if I don’t link through the IDE how do I explcitly link?
These are basic questions. You all have helped me before with the SDL2 which was awesome.

Hi Alex you make some well reasoned arguments against placing the burden of answering my opengl question in SDL2. As such I’ve fixed the problem and would like with the moderator’s permission publish my findings in case somebody follows the breadcrumbs:


Properties->Path and Symbols->[All Configurations] from drop-down menu->Add->type in glu32->Apply->OK

You can also enter it in “build”->Settings->-l but its not recommended this way.