-
undefined reference to `gluOrtho2D'
Hi all,
This is my first program to display a couple of points: what is wrong with it?
On doing below i get:
[surabhi@localhost ~]$ cc points.c -lglut
/tmp/cckmTBn0.o: In function `myinit':
points.c
.text+0x10d): undefined reference to `gluOrtho2D'
collect2: ld returned 1 exit status
The program is as below.
#include<stdlib.h>
#include<GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,0.0);
glBegin(GL_POINTS);
glVertex2f(10.0,10.0);
glVertex2f(150.0,80.0);
glVertex2f(100.0,20.0);
glVertex2f(200.0,100.0);
glEnd();
glFlush();
}
void myinit()
{
glClearColor(0.0,1.0,1.0,1.0);
glPointSize(10.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(.0,50.0,.0,50.0);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(300,200);
glutInitWindowPosition(0,700);
glutCreateWindow("points");
glutDisplayFunc(display);
myinit();
glutMainLoop();
return 0;
}
Do i need to reinstall opengl in my system (fedora)? i have tried installing many glut packages, but i still get this output.
-
Super Moderator
OpenGL Guru
Re: undefined reference to `gluOrtho2D'
Either include glu.h or try glOrtho and add near and far clip values.
-
Super Moderator
OpenGL Lord
Re: undefined reference to `gluOrtho2D'
doing yum install freeglut-devel should be enough.
Then do not forgot to add -lGLU to your linker options too.
-
Re: undefined reference to `gluOrtho2D'
hey guys thanks,adding -lGLU worked!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules