I am using FreeGLUT to try and create my first cube in C++ with OpenGL. I have an issue that whenever I call “gluPerspective”, the compiler throws this error:
build/Debug/MinGW-Windows/main.o: In function `main':
C:\Users\User\Dropbox\NetBeans Workspace\Testing/main.cpp:47: undefined reference to `gluPerspective@32'
I have looked around to see if anyone has had this problem and found nothing. So, I think I am being oblivious to something yet again. Here is where I call the function:
......
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, 1.333, 1, 1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
......
I include freeGLUT and everything else works except that line. I checked the documentation , and it seems as though I am using it correctly. I am at a loss.
gluPerspectivewas removed from GLU (the OpenGL helper library) at version 3.1. Are you compiling against the correct library that still has it defined? If not then you will need to write your own version and pass the matrix direct to OpenGL.OpenGL.org has the gluPerspective code on it’s website (presented here for completeness):