Здравствуйте! Решил попробовать написать простую программу на OpenGL. В качестве среды выбрал Geany. Вот код программы.
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
glFinish();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize(240, 240);
glutInitWindowPosition(100, 100);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Test");
glClearColor(0, 0, 0, 0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
При компиляции выдаётся следующее
/tmp/ccDspfET.o: In function `display()':
Source.cpp:(.text+0xe): undefined reference to `glClear'
Source.cpp:(.text+0x13): undefined reference to `glFlush'
Source.cpp:(.text+0x18): undefined reference to `glFinish'
/tmp/ccDspfET.o: In function `main':
Source.cpp:(.text+0x35): undefined reference to `glutInit'
Source.cpp:(.text+0x49): undefined reference to `glutInitWindowSize'
Source.cpp:(.text+0x5d): undefined reference to `glutInitWindowPosition'
Source.cpp:(.text+0x69): undefined reference to `glutInitDisplayMode'
Source.cpp:(.text+0x75): undefined reference to `glutCreateWindow'
Source.cpp:(.text+0x9d): undefined reference to `glClearColor'
Source.cpp:(.text+0xa9): undefined reference to `glMatrixMode'
Source.cpp:(.text+0xae): undefined reference to `glLoadIdentity'
Source.cpp:(.text+0xd8): undefined reference to `glOrtho'
Source.cpp:(.text+0xe4): undefined reference to `glutDisplayFunc'
Source.cpp:(.text+0xe9): undefined reference to `glutMainLoop'
collect2: выполнение ld завершилось с кодом возврата 1
Сборка завершилась с ошибкой.
Что я делаю не так?