Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9266941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:26:03+00:00 2026-06-18T14:26:03+00:00

I am using FreeGLUT to try and create my first cube in C++ with

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:26:04+00:00Added an answer on June 18, 2026 at 2:26 pm

    gluPerspective was 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):

    //matrix will receive the calculated perspective matrix.
    //You would have to upload to your shader
    // or use glLoadMatrixf if you aren't using shaders.
    void glhPerspectivef2(float *matrix, float fovyInDegrees, float aspectRatio,
                          float znear, float zfar)
    {
        float ymax, xmax;
        float temp, temp2, temp3, temp4;
        ymax = znear * tanf(fovyInDegrees * M_PI / 360.0);
        //ymin = -ymax;
        //xmin = -ymax * aspectRatio;
        xmax = ymax * aspectRatio;
        glhFrustumf2(matrix, -xmax, xmax, -ymax, ymax, znear, zfar);
    }
    void glhFrustumf2(float *matrix, float left, float right, float bottom, float top,
                      float znear, float zfar)
    {
        float temp, temp2, temp3, temp4;
        temp = 2.0 * znear;
        temp2 = right - left;
        temp3 = top - bottom;
        temp4 = zfar - znear;
        matrix[0] = temp / temp2;
        matrix[1] = 0.0;
        matrix[2] = 0.0;
        matrix[3] = 0.0;
        matrix[4] = 0.0;
        matrix[5] = temp / temp3;
        matrix[6] = 0.0;
        matrix[7] = 0.0;
        matrix[8] = (right + left) / temp2;
        matrix[9] = (top + bottom) / temp3;
        matrix[10] = (-zfar - znear) / temp4;
        matrix[11] = -1.0;
        matrix[12] = 0.0;
        matrix[13] = 0.0;
        matrix[14] = (-temp * zfar) / temp4;
        matrix[15] = 0.0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MSVC++ and freeglut in order to use openGL. Now, I have a
I'm involved in a development project that is using freeglut (based on the long
I have written some effects in C++ (g++) using freeglut on Linux, and I
I’m trying to compile a very simple Hello world OpenGL 3.3 program using FreeGLUT.
Using CRM 4, I have an entity form that contains a tab with an
Using CI for the first time and i'm smashing my head with this seemingly
How to make the Haskell GLUT binding using freeglut instead of the original GLUT
Im having an issue using GLUT with monodevelop. Im using the following code: #include
I am using freeglut, windows 8, vs2012 and the newest nvidia driver. But the
I'm making a Connect4 game using freeglut and glew. This is how my game

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.