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

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

作者头像
zhangrelay
发布于 2022-08-10 07:24:19
发布于 2022-08-10 07:24:19
1.1K0
举报

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

手工替换即可。

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

全部记录如下:

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 删除。

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

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
跟我学习php数组常用函数-下篇
如果是递归的,结果:array('hobby' => array('a' => 'ping-pong', 'b' => 'basketball'));
潇洒哥和黑大帅
2018/10/23
5730
PHP asort() 函数
asort() 函数对数组进行排序并保持索引关系。主要用于对那些单元顺序很重要的结合数组进行排序。
用户1448800
2021/08/20
4890
PHP按特定key进行多维数组排序
实际上array_multisort 是PHP内置的方法,官方有说明: PHP - array_multisort
雪碧君
2023/02/15
2.8K0
PHP sort() 函数
实例 对数组 $cars 中的元素按字母进行升序排序: <?php $cars=array("Volvo","BMW","Toyota"); sort($cars); ?> 定义和用法 sort()
用户1448800
2021/08/21
6500
PHP array_multisort() 函数
array_multisort() 函数返回排序数组。您可以输入一个或多个数组。函数先对第一个数组进行排序,接着是其他数组,如果两个或多个值相同,它将对下一个数组进行排序。
用户1448800
2021/08/19
1.6K0
PHP rsort() 函数
rsort() 函数对数组的元素按照键值进行逆向排序。与 arsort() 的功能基本相同。
用户1448800
2021/08/21
6600
PHP 二维数组根据某个字段排序
数据: data[] = array(‘customer_name’ => ‘小李’, ‘money’ => 12, ‘distance’ => 2, ‘address’ => ‘长安街C坊’); data[] = array(‘customer_name’ => ‘赵小雅’, ‘money’ => 89, ‘distance’ => 6, ‘address’ => ‘解放路恒基大厦A座’); data[] = array(‘customer_name’ => ‘李亮亮’, ‘money’ => 45, ‘distance’ => 26, ‘address’ => ‘天山西路198弄’);
全栈程序员站长
2022/08/09
2.2K0
PHP 数组函数整理
array_change_key_case($arr, $case=CASE_LOWER): 将数组键名修改为全大写或全小写, 返回是否成功
烟草的香味
2019/07/25
2.8K0
PHP ksort() 函数
实例 按照键名对关联数组进行升序排序: <?php $age=array("Bill"=>"60","Steve"=>"56","mark"=>"31"); ksort($age); ?> 定义和用法
用户1448800
2021/08/21
6900
PHP arsort() 函数
arsort() 函数对数组进行逆向排序并保持索引关系。主要用于对那些单元顺序很重要的结合数组进行排序。
用户1448800
2021/08/20
1.2K0
PHP数组
函数默认是进行升序排序,同时函数也接受第二个参数指定排序方法:SORT_ASC(升序)、SORT_DESC(降序)
Mirror王宇阳
2020/11/10
7.2K0
PHP array_unique() 函数
array_unique() 先将值作为字符串排序,然后对每个值只保留第一个遇到的键名,接着忽略所有后面的键名。这并不意味着在未排序的 array 中同一个值的第一个出现的键名会被保留。
用户1448800
2021/08/19
4800
PHP 关于数组排序的函数
php的数组排序函数有很多。有按键排序,有按值排序。有升序,有降序。有的排序后改变原数组索引,有的不改变。
写PHP的老王
2019/08/12
1.7K0
PHP 关于数组排序的函数
PHP数组排序 解决数值型版本号排序错乱
本人在写EasySwoole新的组件时,使用到了插件思维,所以需要做包的解析等逻辑。在解析下列版本解析时,发现一些小问题。做个记录。
宣言言言
2020/12/03
8620
PHP中国际化的字符串比较对象
在 PHP 中,国际化的功能非常丰富,包括很多我们可能都不知道的东西其实都非常有用,比如说今天要介绍的这一系列的字符排序和比较的功能。
硬核项目经理
2021/07/15
5180
PHP数组完整操作方法大全
5.对数组中的每个元素应用回调函数,并返回一个新数组,该数组包含回调函数的返回值。
岳泽以
2024/05/28
1670
PHP的多维数组排序
熟悉PHP的小伙伴都知道有很多内置函数可以对数组进行排序操作或者自定义一些排序方法(冒泡)等等。
用户2475223
2019/12/17
3.9K0
PHP 数组相关函数
本文列举了 PHP 数组相关函数。 数组长度 int count(mixed $var [, int $mode = COUNT_NORMAL]); 此函数也可以返回对象的属性个数。 字符串与数组转化 一维数组转化为字符串 string implode( string $glue, array $array); 返回一个字符串,由 $glue(默认为空) 分隔开的数组的值。 分隔字符串,返回数组 array explode( string $delimiter , string $string [, int
康怀帅
2018/02/28
1.5K0
Array数组函数(三)
array_keys — 返回数组中所有的键名 array_values — 返回数组中所有的值 array_key_exists — 检查给定的键名或索引是否存在于数组中 <?php$phpha=
wangxl
2018/03/07
1K0
PHP 二维关联数组根据其中一个字段排序
PHP 中二维关联数组如何根据其中一个字段进行排序,下面的代码将二维关联数组 array 根据 orderby 字段进行排序:
Denis
2023/04/15
9180
相关推荐
跟我学习php数组常用函数-下篇
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档