PDA

View Full Version : Where do I start?



erik-k
04-30-2004, 06:08 PM
Completely new to openGL here. Running Mandrake Linux on a PC with GCC.

I've got MESA installed, and it looks like I'm ready to go. The compiler doesn't seem to complain about not finding the calls I reference, but then generates a bizzare message about not being able to find some temp file

Here's the source:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void main(int argc, char **argv)
{

glBegin(GL_LINES);
glVertex2i(0,0);
glVertex2i(1,0);
glVertex2i(1,1);
glvertex2i(0,1);
glEnd();
}

And here's the error output:
[erik-k@erik opengl]$ gcc -o hello helloworld.c
helloworld.c: In function `main':
helloworld.c:21: warning: return type of `main' is not `int'
/home/erik-k/tmp/ccc0mOMC.o(.text+0x16): In function `main':
: undefined reference to `glBegin'
/home/erik-k/tmp/ccc0mOMC.o(.text+0x25): In function `main':
: undefined reference to `glVertex2i'
/home/erik-k/tmp/ccc0mOMC.o(.text+0x34): In function `main':
: undefined reference to `glVertex2i'
/home/erik-k/tmp/ccc0mOMC.o(.text+0x43): In function `main':
: undefined reference to `glVertex2i'
/home/erik-k/tmp/ccc0mOMC.o(.text+0x52): In function `main':
: undefined reference to `glvertex2i'
/home/erik-k/tmp/ccc0mOMC.o(.text+0x5a): In function `main':
: undefined reference to `glEnd'
collect2: ld returned 1 exit status

I have no idea what this means; The program sucessfully includes GL/gl.h, GL/glu.h, and GL/glut.h, and I can sucessfully compile and use openGL programs on my computer.

Can someone point me to an openGL tutorial for LINUX, on a PC with MESA? Just reading MAN pages won't cut it forever.

dorbie
05-01-2004, 05:56 PM
You need to link to the libraries you need. Looks like you have the header files but you do no linking on the command line.

Please post this type of question in the Linux forum in future.

05-02-2004, 12:35 AM
i think except those files you need
i am using DEV C++, i need to set the parameters in the linker option, not sure if it work in your case
also main better not to be void