Multiple c++ OpenGL errors that I don't know how to fix...

Hello I am making a window in OpenGL (I assume) and I get 42 errors here are two that I am trying to fix:
"[Error] 'glVeiwport' was not declared in this scope"
"[Error] 'gluPerspective' was not declared in this scope"

Here is my code:

The code is possibly way too big for this

Please help! :)
Last edited on
typo. it's glViewport.

gluPerspective is not part of OpenGL, it's part of the library called GLU.
I assume it is finding your call to #include <GL/glu.h>, but you'll also need to link to the glu library, glu32, in the same way you linked to opengl, opengl32.
What compiler or IDE are you using?

My opinion: Before you get too far into learning old OpenGL, I would highly suggest learning OpenGL 3.3+ instead. Functions like gluPerspective are deprecated for modern versions of OpenGL, and there would be no point in using GLU.


I compiled (well, tried to) with
g++ Test.cpp -o test.exe -lopengl32 -lglu32

You have a lot of typos.
ShowCurser --> ShowCursor
wglMakdCurrent -> wglMakeCurrent
NUL -> NULL (preferably nullptr...)
UnregisteredClass -> UnregisterClass

There's others, too. Are you trying to type from memory or something? Go through your code again and make sure you're naming things right.
Last edited on
Ok thanks I did not notice the typo also yeah I thought I was learning the modern OpenGL... Well that sucks :)
And you have other typos as well, if you still want to get your program to compile instead of restarting at modern opengl (I suggest the website I linked above, if you do though).

Fair warning: Modern OpenGL (3.3+), as opposed to the old immediate mode OpenGL, is more complex to initially set up, but performs better and can use modern techniques and shaders. There will be headaches, but you will be learning the modern way of doing things.

Note that if you want to mess around with graphics without having to worry about every detail, there do exist libraries that abstract a lot of the stuff for you, such as SFML (for 2D graphics, has a very clean interface IMO), and a varying degree of quality for 3D graphics (for example, OGRE, irrlicht, or openscenegraph, and others).
Last edited on
Registered users can post here. Sign in or register to post.