@Ivanusha

В чём проблема запуска игры на c++ с glut?

Сама ошибка.
...\speedprogramming-master\snake>g++ main.cpp field.cpp game.cpp painter.cpp snake.cpp -o bch.exe
main.cpp:3:10: error: #include expects "FILENAME" or <FILENAME>
 #include glut.h
          ^~~~
main.cpp: In function 'void display()':
main.cpp:9:11: error: 'GL_COLOR_BUFFER_BIT' was not declared in this scope
   glClear(GL_COLOR_BUFFER_BIT);
           ^~~~~~~~~~~~~~~~~~~
main.cpp:9:3: error: 'glClear' was not declared in this scope
   glClear(GL_COLOR_BUFFER_BIT);
   ^~~~~~~
main.cpp:12:3: error: 'glutSwapBuffers' was not declared in this scope
   glutSwapBuffers();
   ^~~~~~~~~~~~~~~
main.cpp: In function 'void timer(int)':
main.cpp:19:3: error: 'glutTimerFunc' was not declared in this scope
   glutTimerFunc(300, timer, 0);
   ^~~~~~~~~~~~~
main.cpp: In function 'void keyEvent(int, int, int)':
main.cpp:26:8: error: 'GLUT_KEY_LEFT' was not declared in this scope
   case GLUT_KEY_LEFT:
        ^~~~~~~~~~~~~
main.cpp:29:8: error: 'GLUT_KEY_UP' was not declared in this scope
   case GLUT_KEY_UP:
        ^~~~~~~~~~~
main.cpp:32:8: error: 'GLUT_KEY_RIGHT' was not declared in this scope
   case GLUT_KEY_RIGHT:
        ^~~~~~~~~~~~~~
main.cpp:35:8: error: 'GLUT_KEY_DOWN' was not declared in this scope
   case GLUT_KEY_DOWN:
        ^~~~~~~~~~~~~
main.cpp: In function 'int main(int, char**)':
main.cpp:43:3: error: 'glutInit' was not declared in this scope
   glutInit(&argc, argv);
   ^~~~~~~~
main.cpp:44:23: error: 'GLUT_DOUBLE' was not declared in this scope
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
                       ^~~~~~~~~~~
main.cpp:44:37: error: 'GLUT_RGB' was not declared in this scope
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
                                     ^~~~~~~~
main.cpp:44:3: error: 'glutInitDisplayMode' was not declared in this scope
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
   ^~~~~~~~~~~~~~~~~~~
main.cpp:45:3: error: 'glutInitWindowSize' was not declared in this scope
   glutInitWindowSize(Field::WIDTH * Field::BLOCK_WIDTH,
   ^~~~~~~~~~~~~~~~~~
main.cpp:47:3: error: 'glutInitWindowPosition' was not declared in this scope
   glutInitWindowPosition(100, 780);
   ^~~~~~~~~~~~~~~~~~~~~~
main.cpp:48:3: error: 'glutCreateWindow' was not declared in this scope
   glutCreateWindow("Snake");
   ^~~~~~~~~~~~~~~~
main.cpp:49:3: error: 'glClearColor' was not declared in this scope
   glClearColor(0, 0, 0, 1.0);
   ^~~~~~~~~~~~
main.cpp:50:16: error: 'GL_PROJECTION' was not declared in this scope
   glMatrixMode(GL_PROJECTION);
                ^~~~~~~~~~~~~
main.cpp:50:3: error: 'glMatrixMode' was not declared in this scope
   glMatrixMode(GL_PROJECTION);
   ^~~~~~~~~~~~
main.cpp:51:3: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
   ^~~~~~~~~~~~~~
main.cpp:52:3: error: 'glOrtho' was not declared in this scope
   glOrtho(0, Field::WIDTH * Field::BLOCK_WIDTH,
   ^~~~~~~
main.cpp:55:3: error: 'glutDisplayFunc' was not declared in this scope
   glutDisplayFunc(display);
   ^~~~~~~~~~~~~~~
main.cpp:56:3: error: 'glutSpecialFunc' was not declared in this scope
   glutSpecialFunc(keyEvent);
   ^~~~~~~~~~~~~~~
main.cpp:59:3: error: 'glutMainLoop' was not declared in this scope
   glutMainLoop();
   ^~~~~~~~~~~~
  • Вопрос задан
  • 200 просмотров
Пригласить эксперта
Ответы на вопрос 1
profesor08
@profesor08
error: #include expects "FILENAME" or
#include glut.h
нет заголовочного файла glut.h, добавь и все заработает
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы