Skip to content

Instantly share code, notes, and snippets.

@prp-e
Created September 26, 2015 14:51
Show Gist options
  • Save prp-e/e250b3f1318a696c65fa to your computer and use it in GitHub Desktop.
Save prp-e/e250b3f1318a696c65fa to your computer and use it in GitHub Desktop.
#include <iostream>
#include <GL/freeglut.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/gl.h>
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
}
int main(int argc, char** argv){
glutInit(&argc, argv);
glutCreateWindow("Hello, Square");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
@prp-e
Copy link
Author

prp-e commented Sep 26, 2015

/tmp/ccjA7KCD.o: In function display()': 1.cpp:(.text+0xa): undefined reference toglClear'
1.cpp:(.text+0x14): undefined reference to glBegin' 1.cpp:(.text+0x29): undefined reference toglVertex2f'
1.cpp:(.text+0x3e): undefined reference to glVertex2f' 1.cpp:(.text+0x53): undefined reference toglVertex2f'
1.cpp:(.text+0x68): undefined reference to glVertex2f' 1.cpp:(.text+0x6d): undefined reference toglEnd'
1.cpp:(.text+0x72): undefined reference to glFlush' /tmp/ccjA7KCD.o: In functionmain':
1.cpp:(.text+0x96): undefined reference to glutInit' 1.cpp:(.text+0xa0): undefined reference toglutCreateWindow'
1.cpp:(.text+0xaa): undefined reference to glutDisplayFunc' 1.cpp:(.text+0xaf): undefined reference toglutMainLoop'
collect2: error: ld returned 1 exit status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment