compiling problem: undefined reference to `function_name'

  • Follow


hi all..

when i try to compile this program gcc return this list of 'errors'..

this is a piece of the source code..
<code>
#include <GL/glut.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();
...
</code>

this the errors list 
<errors_list>
/tmp/cc3aHpJh.o(.text+0xf): In function `display':
: undefined reference to `glClear'
/tmp/cc3aHpJh.o(.text+0x2c): In function `display':
: undefined reference to `glColor3f'
/tmp/cc3aHpJh.o(.text+0x39): In function `display':
: undefined reference to `glBegin'
/tmp/cc3aHpJh.o(.text+0x56): In function `display':
: undefined reference to `glVertex3f'
/tmp/cc3aHpJh.o(.text+0x73): In function `display':
: undefined reference to `glVertex3f'
/tmp/cc3aHpJh.o(.text+0x90): In function `display':
: undefined reference to `glVertex3f'
/tmp/cc3aHpJh.o(.text+0xad): In function `display':
: undefined reference to `glVertex3f'
/tmp/cc3aHpJh.o(.text+0xb5): In function `display':
: undefined reference to `glEnd'
...
<errors_list/>

someone can help me?
or tell me where i can found some docs to resolve this problem by myself?

thanks to all
0
Reply unknown 2/7/2005 4:01:23 PM

unknown wrote:
> hi all..
> 
> when i try to compile this program gcc return this list of 'errors'..

> /tmp/cc3aHpJh.o(.text+0xb5): In function `display':
> : undefined reference to `glEnd'
> ..

the linker cannot resolve the references to the gl-functions.
try linking against libGL.

like "gcc test.c -lGL"

mfg.a.dr
IOhannes
0
Reply IOhannes 2/7/2005 7:30:35 PM


IOhannes m zmoelnig wrote:

> unknown wrote:
>> hi all..
>> 
>> when i try to compile this program gcc return this list of 'errors'..
> 
>> /tmp/cc3aHpJh.o(.text+0xb5): In function `display':
>> : undefined reference to `glEnd'
>> ..
> 
> the linker cannot resolve the references to the gl-functions.
> try linking against libGL.
> 
> like "gcc test.c -lGL"
> 
> mfg.a.dr
> IOhannes

i resolve by this way..

gcc -lglut test.c

by the way, thanks

0
Reply unknown 2/7/2005 10:15:16 PM

2 Replies
404 Views

(page loaded in 0.059 seconds)

Similiar Articles:













7/22/2012 11:53:16 AM


Reply: