F
Foliage
Здравствуйте. Постараюсь быть кратким.
Юзаю Dev-C++ версии 4.9.9.2 и Glut версии 3.5.
Приведенный ниже код был взят из книги, но у меня выдает ошибку при компиляции.
Заранее спасибо за помощь
Юзаю Dev-C++ версии 4.9.9.2 и Glut версии 3.5.
Приведенный ниже код был взят из книги, но у меня выдает ошибку при компиляции.
Заранее спасибо за помощь
Код:
#include <stdlib.h>
#include <gl/glut.h>
GLint Width = 512, Height = 512;
const int CubeSize = 200;
void Display(void)
{
int left, right, top, bottom;
left = (Width - CubeSize)/2;
right = left + CubeSize;
bottom = (Height - CubeSize)/2;
top = bottom + CubeSize;
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glColor3ub(255, 0, 0);
glBegin(GL_QUADS);
glVertex2f(left, bottom);
glVertex2f(left, top);
glVertex2f(right, top);
glVertex2f(right, bottom);
glEnd();
glFinish();
}
void Reshape(GLint w, GLint h)
{
Width = w;
Height = h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, w, 0, h, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void Keyboard(unsigned char key, int x, int y)
{
#define ESCAPE '\033'
if (key == ESCAPE) exit(0);
}
main (int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(Width, Height);
glutCreateWindow("Red square example");
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Keyboard);
glutMainLoop();
}
Код:
[Linker error] undefined reference to 'glClearColor@16'
[Linker error] undefined reference to 'glClear@4'
[Linker error] undefined reference to 'glColor3ub@12'
[Linker error] undefined reference to 'glBegin@4'
[Linker error] undefined reference to 'glVertex2f@8'
[Linker error] undefined reference to 'glVertex2f@8'
[Linker error] undefined reference to 'glVertex2f@8'
[Linker error] undefined reference to 'glVertex2f@8'
[Linker error] undefined reference to 'glEnd@0'
[Linker error] undefined reference to 'glFinish@0'
[Linker error] undefined reference to 'glViewport@16'
[Linker error] undefined reference to 'glMatrixMode@4'
[Linker error] undefined reference to 'glLoadIdentity@0'
[Linker error] undefined reference to 'glOrtho@48'
[Linker error] undefined reference to 'glMatrixMode@4'
[Linker error] undefined reference to 'glLoadIdentity@0'
[Linker error] undefined reference to 'glutInit@8'
[Linker error] undefined reference to 'glutInitDisplayMode@4'
[Linker error] undefined reference to 'glutInitWindowSize@8'
[Linker error] undefined reference to 'glutCreateWindow@4'
[Linker error] undefined reference to 'glutDisplayFunc@4'
[Linker error] undefined reference to 'glutReshapeFunc@4'
[Linker error] undefined reference to 'glutKeyboardFunc@4'
[Linker error] undefined reference to 'glutMainLoop@0'
Id returned 1 exit status
C:\Dev-Cpp\ProjectGL\Makefile.win [Build Error] [ProjectGL.exe] Error 1