Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Undefined reference - glPushMatrix()

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2010
    Location
    China
    Posts
    20

    Undefined reference - glPushMatrix()

    Need help! As a new guy for C++ programming, I found the problem of undefined reference of glPushMatrix(), part of it as below. Can it be fixed, as I working OpenGL at Code::Blocks on Window Vista?

    ================================================== ============

    #pragma comment(linker, "/subsystem:windows")

    #include <windows.h>
    #include <gl/gl.h>
    #include <gl/glu.h>
    #include <gl/glaux.h>

    HDC g_HDC;
    float angle = 0.0f;
    float legAngle[2] = {0.0f, 0.0f};
    float armAngle[2] = {0.0f, 0.0f};
    bool fullScreen = false;

    void DrawCube(float xPos, float yPos, float zPos)
    {
    glPushMatrix();
    .....
    New guy for programing in C++ at OpenGL environment!

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: Undefined reference - glPushMatrix()

    Undefined references is a linker message, means you miss a library.
    In the project linker options add the library GL (or opengl32).

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2010
    Location
    China
    Posts
    20

    Re: Undefined reference - glPushMatrix()

    Thanks for your prompt input. How can I get that library ?
    New guy for programing in C++ at OpenGL environment!

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2010
    Location
    China
    Posts
    20

    Re: Undefined reference - glPushMatrix()

    I tried to link opengl32.a. The error of "Undefined reference - glPushMatrix() " was cancelled, but the error was switched to "Undefined reference to gluPerspectiv@32". Need any further input. Tks.
    New guy for programing in C++ at OpenGL environment!

  5. #5
    Junior Member Regular Contributor
    Join Date
    Apr 2006
    Location
    Kyoto.
    Posts
    129

    Re: Undefined reference - glPushMatrix()

    looks like you need to link to glu32.lib

    http://www.opengl.org/resources/faq/...ingstarted.htm
    look at section 2.060

  6. #6
    Junior Member Newbie
    Join Date
    Apr 2010
    Location
    China
    Posts
    20

    Re: Undefined reference - glPushMatrix()

    Ooh! Thanks a lot! I made it. Great Tks.
    New guy for programing in C++ at OpenGL environment!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •