Undefined reference 'gluOrtho2d' error in opengl using with c
The above error comes when the following code is executed in C.
#include <GL/gl.h>
#include<stdio.h>
#include<math.h>
#include <GL/glu.h>
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
gluOrtho2D(0.0, 500, 0.0, 500);
glClearColor(1.0, 1.0, 1.0, 1.0); // Set clear color to white
gluOrtho2D(0.0, 500, 0.0, 500);
// Draw sky
glBegin(GL_POLYGON);
glColor3f(0.0, 1.0, 1.0); // Light blue color
glVertex2f(200.0, 80.0);
glVertex2f(100.0, 200.0);
glVertex2f(200.0, 200.0);
glVertex2f(200.0, 80.0);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(800, 600);
glutCreateWindow("Assignment");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
I'm trying to draw the below scene without using the default coordinate system in openGL and trying to make the (0,0) at the bottom left.