前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >glut库更新旧程序无法完成编译问题描述

glut库更新旧程序无法完成编译问题描述

作者头像
zhangrelay
发布2022-08-10 15:24:19
9170
发布2022-08-10 15:24:19
举报

其实就是很多变量名称出现了变动。

手工替换即可。

绿色部分是系统给出的提示。对应错误需要全部都修订。

全部记录如下:

zhangrelay@LAPTOP-5REQ7K1L:~$ cd cppcode/Bouncing-Ball-Animation-master/src/

zhangrelay@LAPTOP-5REQ7K1L:~/cppcode/Bouncing-Ball-Animation-master/src$ make

g++ -std=c++11 -g -o a.out main.cpp ball.cpp eventHandling.cpp gui.cpp imageloader.cpp tinyfiledialogs.c -lglui -lglut -lGLU -lGL -lm

main.cpp: In function ‘int main(int, char**)’:

main.cpp:17:5: error: ‘glutInit’ was not declared in this scope

17 | glutInit(&argc, argv); //Initialize GLUT

| ^~~~~~~~

main.cpp:18:25: error: ‘GLUT_DOUBLE’ was not declared in this scope; did you mean ‘GL_DOUBLE’?

18 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

| ^~~~~~~~~~~

| GL_DOUBLE

main.cpp:18:39: error: ‘GLUT_RGBA’ was not declared in this scope; did you mean ‘GL_RGBA’?

18 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

| ^~~~~~~~~

| GL_RGBA

main.cpp:18:51: error: ‘GLUT_DEPTH’ was not declared in this scope; did you mean ‘GL_DEPTH’?

18 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

| ^~~~~~~~~~

| GL_DEPTH

main.cpp:18:5: error: ‘glutInitDisplayMode’ was not declared in this scope

18 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

| ^~~~~~~~~~~~~~~~~~~

main.cpp:19:5: error: ‘glutInitWindowSize’ was not declared in this scope

19 | glutInitWindowSize(winw,winh); //Set the window size

| ^~~~~~~~~~~~~~~~~~

main.cpp:20:37: error: ‘GLUT_SCREEN_WIDTH’ was not declared in this scope

20 | glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH)-winw)/2,(glutGet(GLUT_SCREEN_HEIGHT)-winh)/2);

| ^~~~~~~~~~~~~~~~~

main.cpp:20:29: error: ‘glutGet’ was not declared in this scope

20 | glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH)-winw)/2,(glutGet(GLUT_SCREEN_HEIGHT)-winh)/2);

| ^~~~~~~

main.cpp:20:73: error: ‘GLUT_SCREEN_HEIGHT’ was not declared in this scope

20 | glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH)-winw)/2,(glutGet(GLUT_SCREEN_HEIGHT)-winh)/2);

| ^~~~~~~~~~~~~~~~~~

main.cpp:20:5: error: ‘glutInitWindowPosition’ was not declared in this scope

20 | glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH)-winw)/2,(glutGet(GLUT_SCREEN_HEIGHT)-winh)/2);

| ^~~~~~~~~~~~~~~~~~~~~~

main.cpp:22:23: error: ‘glutCreateWindow’ was not declared in this scope

22 | main_window = glutCreateWindow("Bouncing Balls Animation"); //Create the window

| ^~~~~~~~~~~~~~~~

main.cpp:27:5: error: ‘glutDisplayFunc’ was not declared in this scope

27 | glutDisplayFunc(drawScene);

| ^~~~~~~~~~~~~~~

main.cpp:28:5: error: ‘glutTimerFunc’ was not declared in this scope

28 | glutTimerFunc(_time, update, 0);

| ^~~~~~~~~~~~~

main.cpp:33:9: error: ‘glutMotionFunc’ was not declared in this scope

33 | glutMotionFunc(MouseMotion);

| ^~~~~~~~~~~~~~

main.cpp:34:9: error: ‘glutPassiveMotionFunc’ was not declared in this scope

34 | glutPassiveMotionFunc(MousePassiveMotion);

| ^~~~~~~~~~~~~~~~~~~~~

main.cpp:145:5: error: ‘glutMainLoop’ was not declared in this scope

145 | glutMainLoop(); //Start the main loop. glutMainLoop doesn't return.

| ^~~~~~~~~~~~

eventHandling.cpp: In function ‘void MouseButton(int, int, int, int)’:

eventHandling.cpp:63:33: error: ‘GLUT_UP’ was not declared in this scope

63 | if (state == GLUT_UP) // Disregard redundant GLUT_UP events

| ^~~~~~~

eventHandling.cpp:67:32: error: ‘GLUT_LEFT_BUTTON’ was not declared in this scope

67 | if ( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) {

| ^~~~~~~~~~~~~~~~

eventHandling.cpp:67:61: error: ‘GLUT_DOWN’ was not declared in this scope

67 | if ( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) {

| ^~~~~~~~~

eventHandling.cpp:75:22: error: ‘GLUT_DOWN’ was not declared in this scope

75 | if (state == GLUT_DOWN) {

| ^~~~~~~~~

eventHandling.cpp:79:30: error: ‘GLUT_LEFT_BUTTON’ was not declared in this scope

79 | case GLUT_LEFT_BUTTON:

| ^~~~~~~~~~~~~~~~

eventHandling.cpp:81:30: error: ‘GLUT_MIDDLE_BUTTON’ was not declared in this scope

81 | case GLUT_MIDDLE_BUTTON:

| ^~~~~~~~~~~~~~~~~~

eventHandling.cpp:84:30: error: ‘GLUT_RIGHT_BUTTON’ was not declared in this scope

84 | case GLUT_RIGHT_BUTTON:

| ^~~~~~~~~~~~~~~~~

eventHandling.cpp:90:30: error: ‘GLUT_LEFT_BUTTON’ was not declared in this scope

90 | case GLUT_LEFT_BUTTON:

| ^~~~~~~~~~~~~~~~

eventHandling.cpp:93:30: error: ‘GLUT_MIDDLE_BUTTON’ was not declared in this scope

93 | case GLUT_MIDDLE_BUTTON:

| ^~~~~~~~~~~~~~~~~~

eventHandling.cpp:96:30: error: ‘GLUT_RIGHT_BUTTON’ was not declared in this scope

96 | case GLUT_RIGHT_BUTTON:

| ^~~~~~~~~~~~~~~~~

eventHandling.cpp:109:9: error: ‘glutPostRedisplay’ was not declared in this scope

109 | glutPostRedisplay();

| ^~~~~~~~~~~~~~~~~

eventHandling.cpp: In function ‘void MouseMotion(int, int)’:

eventHandling.cpp:124:9: error: ‘glutPostRedisplay’ was not declared in this scope

124 | glutPostRedisplay();

| ^~~~~~~~~~~~~~~~~

eventHandling.cpp: In function ‘void handleSpecialKeypress(int, int, int)’:

eventHandling.cpp:150:22: error: ‘GLUT_KEY_UP’ was not declared in this scope

150 | case(GLUT_KEY_UP): //Up Arrow

| ^~~~~~~~~~~

eventHandling.cpp:153:22: error: ‘GLUT_KEY_DOWN’ was not declared in this scope

153 | case(GLUT_KEY_DOWN): // Down Arrow

| ^~~~~~~~~~~~~

eventHandling.cpp:156:22: error: ‘GLUT_KEY_LEFT’ was not declared in this scope

156 | case(GLUT_KEY_LEFT): // Down Arrow

| ^~~~~~~~~~~~~

eventHandling.cpp:159:22: error: ‘GLUT_KEY_RIGHT’ was not declared in this scope

159 | case(GLUT_KEY_RIGHT): // Down Arrow

| ^~~~~~~~~~~~~~

eventHandling.cpp: In function ‘void cbMode(int)’:

eventHandling.cpp:332:9: error: ‘glutPostRedisplay’ was not declared in this scope

332 | glutPostRedisplay();

| ^~~~~~~~~~~~~~~~~

gui.cpp: In function ‘void update(int)’:

gui.cpp:97:9: error: ‘glutPostRedisplay’ was not declared in this scope

97 | glutPostRedisplay(); //Tell GLUT that the scene has changed

| ^~~~~~~~~~~~~~~~~

gui.cpp:98:5: error: ‘glutTimerFunc’ was not declared in this scope

98 | glutTimerFunc(_time, update, 0);

| ^~~~~~~~~~~~~

gui.cpp: In function ‘void drawScene()’:

gui.cpp:213:41: error: ‘glutSolidSphere’ was not declared in this scope

213 | glutSolidSphere(Balls[z].getRadius(),50,50);

| ^~~~~~~~~~~~~~~

gui.cpp:218:17: error: ‘glutSwapBuffers’ was not declared in this scope

218 | glutSwapBuffers(); //Send the 3D scene to the screen

| ^~~~~~~~~~~~~~~

gui.cpp:283:41: error: ‘glutSolidSphere’ was not declared in this scope

283 | glutSolidSphere(Balls[z].getRadius(),50,50);

| ^~~~~~~~~~~~~~~

gui.cpp:286:81: error: ‘glutWireSphere’ was not declared in this scope; did you mean ‘gluSphere’?

286 | if (ball_selected == Balls[z].getId()) glutWireSphere(Balls[z].getRadius()+0.03,20,20);

| ^~~~~~~~~~~~~~

| gluSphere

gui.cpp:292:17: error: ‘glutSwapBuffers’ was not declared in this scope

292 | glutSwapBuffers(); //Send the 3D scene to the screen

| ^~~~~~~~~~~~~~~

gui.cpp: In function ‘void myGlutIdle()’:

gui.cpp:314:8: error: ‘glutGetWindow’ was not declared in this scope

314 | if ( glutGetWindow() != main_window )

| ^~~~~~~~~~~~~

gui.cpp:315:5: error: ‘glutSetWindow’ was not declared in this scope

315 | glutSetWindow(main_window);

| ^~~~~~~~~~~~~

gui.cpp:319:9: error: ‘glutPostRedisplay’ was not declared in this scope

319 | glutPostRedisplay();

| ^~~~~~~~~~~~~~~~~

tinyfiledialogs.c: In function ‘int tkinter2Present()’:

tinyfiledialogs.c:592:48: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 240 and 255 [-Wformat-overflow=]

592 | sprintf ( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;

| ^~ ~~~~~~~~~~~~~

tinyfiledialogs.c:592:25: note: ‘sprintf’ output between 2 and 272 bytes into a destination of size 256

592 | sprintf ( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;

| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tinyfiledialogs.c:609:32: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 240 and 255 [-Wformat-overflow=]

609 | sprintf ( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;

| ^~ ~~~~~~~~~~~~~

tinyfiledialogs.c:609:9: note: ‘sprintf’ output between 2 and 272 bytes into a destination of size 256

609 | sprintf ( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;

| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tinyfiledialogs.c:599:32: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 240 and 255 [-Wformat-overflow=]

599 | sprintf ( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;

| ^~ ~~~~~~~~~~~~~

tinyfiledialogs.c:599:9: note: ‘sprintf’ output between 2 and 272 bytes into a destination of size 256

599 | sprintf ( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;

| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make: *** [makefile:7: all] Error 1

zhangrelay@LAPTOP-5REQ7K1L:~/cppcode/Bouncing-Ball-Animation-master/src$


编译案例简介:

弹跳球动画

  • 一个模拟 2D 和 3D 球之间碰撞的 c++ 项目。
  • 使用 openGL、glut 和 glui 库构建。
  • Glui 实现了一个非常简单和强大的 GUI,允许用户控制球的不同属性。

特征

  • 用户可以播放/暂停场景,改变球的数量,改变球的颜色,增加/减少球的速度。
  • 用户可以通过单击来选择特定的球,然后更改其相应的属性。
  • 如果没有球被选中,那么所有球的属性都会改变。
  • 支持四种“外观和感觉”选项 - 默认、金属、高对比度、台球/台球
  • 2D 和 3D 模式。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022-07-14,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档