PDA

View Full Version : Undefined reference - glPushMatrix()



JCheng
04-05-2010, 07:41 AM
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();
.....

ZbuffeR
04-05-2010, 07:47 AM
Undefined references is a linker message, means you miss a library.
In the project linker options add the library GL (or opengl32).

JCheng
04-05-2010, 05:27 PM
Thanks for your prompt input. How can I get that library ?

JCheng
04-05-2010, 05:54 PM
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.

James A.
04-05-2010, 06:07 PM
looks like you need to link to glu32.lib

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

JCheng
04-06-2010, 06:23 AM
Ooh! Thanks a lot! I made it. Great Tks.