d3xtor
02-17-2004, 06:40 PM
I get these errors compiling opengl source code in Linux:
/tmp/ccXUFm6i.o(.text+0xf): In function `display':
: undefined reference to `glClear'
/tmp/ccXUFm6i.o(.text+0x29): In function `display':
: undefined reference to `glColor3f'
/tmp/ccXUFm6i.o(.text+0x36): In function `display':
: undefined reference to `glBegin'
/tmp/ccXUFm6i.o(.text+0x4d): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x64): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x7b): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x92): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x9a): In function `display':
: undefined reference to `glEnd'
/tmp/ccXUFm6i.o(.text+0x9f): In function `display':
: undefined reference to `glFlush'
/tmp/ccXUFm6i.o(.text+0xb4): In function `init':
: undefined reference to `glClearColor'
/tmp/ccXUFm6i.o(.text+0xc4): In function `init':
: undefined reference to `glMatrixMode'
/tmp/ccXUFm6i.o(.text+0xcc): In function `init':
: undefined reference to `glLoadIdentity'
/tmp/ccXUFm6i.o(.text+0xf5): In function `init':
: undefined reference to `glOrtho'
/tmp/ccXUFm6i.o(.text+0x119): In function `main':
: undefined reference to `glutInit'
/tmp/ccXUFm6i.o(.text+0x126): In function `main':
: undefined reference to `glutInitDisplayMode'
/tmp/ccXUFm6i.o(.text+0x13b): In function `main':
: undefined reference to `glutInitWindowSize'
/tmp/ccXUFm6i.o(.text+0x14a): In function `main':
: undefined reference to `glutInitWindowPosition'
/tmp/ccXUFm6i.o(.text+0x15a): In function `main':
: undefined reference to `glutCreateWindow'
/tmp/ccXUFm6i.o(.text+0x16f): In function `main':
: undefined reference to `glutDisplayFunc'
/tmp/ccXUFm6i.o(.text+0x177): In function `main':
: undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
from the very firsr opengl example form the redbook. here is the source anyways:
#include <GL/glut.h>
#include <GL/gl.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glBegin (GL_POLYGON);
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();
}
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
also all other code does the same thing. anyone may know why?
/tmp/ccXUFm6i.o(.text+0xf): In function `display':
: undefined reference to `glClear'
/tmp/ccXUFm6i.o(.text+0x29): In function `display':
: undefined reference to `glColor3f'
/tmp/ccXUFm6i.o(.text+0x36): In function `display':
: undefined reference to `glBegin'
/tmp/ccXUFm6i.o(.text+0x4d): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x64): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x7b): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x92): In function `display':
: undefined reference to `glVertex3f'
/tmp/ccXUFm6i.o(.text+0x9a): In function `display':
: undefined reference to `glEnd'
/tmp/ccXUFm6i.o(.text+0x9f): In function `display':
: undefined reference to `glFlush'
/tmp/ccXUFm6i.o(.text+0xb4): In function `init':
: undefined reference to `glClearColor'
/tmp/ccXUFm6i.o(.text+0xc4): In function `init':
: undefined reference to `glMatrixMode'
/tmp/ccXUFm6i.o(.text+0xcc): In function `init':
: undefined reference to `glLoadIdentity'
/tmp/ccXUFm6i.o(.text+0xf5): In function `init':
: undefined reference to `glOrtho'
/tmp/ccXUFm6i.o(.text+0x119): In function `main':
: undefined reference to `glutInit'
/tmp/ccXUFm6i.o(.text+0x126): In function `main':
: undefined reference to `glutInitDisplayMode'
/tmp/ccXUFm6i.o(.text+0x13b): In function `main':
: undefined reference to `glutInitWindowSize'
/tmp/ccXUFm6i.o(.text+0x14a): In function `main':
: undefined reference to `glutInitWindowPosition'
/tmp/ccXUFm6i.o(.text+0x15a): In function `main':
: undefined reference to `glutCreateWindow'
/tmp/ccXUFm6i.o(.text+0x16f): In function `main':
: undefined reference to `glutDisplayFunc'
/tmp/ccXUFm6i.o(.text+0x177): In function `main':
: undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
from the very firsr opengl example form the redbook. here is the source anyways:
#include <GL/glut.h>
#include <GL/gl.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glBegin (GL_POLYGON);
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();
}
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
also all other code does the same thing. anyone may know why?