I'm using the OpenGL lib, but in compiling the gcc is returned undefined reference, could anyone help?

0
#include <GL/gl.h>
#include <GL/glut.h>

void reshape(int w, int h) {
glViewport(0, 0, w, h); /* Establish viewing area to cover entire 
window. */
glMatrixMode(GL_PROJECTION); /* Start modifying the projection matrix. 
*/
glLoadIdentity(); /* Reset project matrix. */
glOrtho(0, w, 0, h, -1, 1); /* Map abstract coords directly to window 
coords. */
glScalef(1, -1, 1); /* Invert Y axis so increasing Y goes down. */
glTranslatef(0, -h, 0); /* Shift origin up to upper-left corner. */
}

void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0.0, 0.0, 1.0); /* blue */
glVertex2i(0, 0);
glColor3f(0.0, 1.0, 0.0); /* green */
glVertex2i(200, 200);
glColor3f(1.0, 0.0, 0.0); /* red */
glVertex2i(20, 200);
glEnd();
glFlush(); /* Single buffered, so needs a flush. */
}

int main(int argc, char **argv) {
glutInit(&argc, argv);
glutCreateWindow("single triangle");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0; [![referencia indefinida][1]][1]
}
    
asked by anonymous 19.11.2017 / 03:53

0 answers