Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,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 删除。

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

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
实验8 OpenGL交互
(1) 运行示范实验代码1,掌握程序鼠标交互方法,尝试为其添加键盘与菜单控制,实现同样功能;
步行者08
2018/10/09
1.2K0
OpenGl 实现鼠标分别移动多个物体
原文链接:https://www.cnblogs.com/DOMLX/p/11620088.html
徐飞机
2019/10/06
2.7K0
用OpenGL实现跳跃的立体小球
一、目的 掌握OpenGL中显示列表对象的使用方法。 二、示例代码 #include "stdafx.h" #include <GL/glut.h> #include <cmath> #include <stdlib.h> #include <GL/glut.h> #include <math.h> //色彩全局常量 GLfloat WHITE[] = { 1, 1, 1 }; //白色 GLfloat RED[] = { 1, 0, 0 }; //红色 GLfloat GREEN[] = {
Zoctopus
2018/06/04
1.1K0
OpenGL OpenCV根据视差图重建三维信息
代码如下: // disparity_to_3d_reconstruction.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" //Huang,Hai
流川疯
2022/11/29
4260
OpenGL OpenCV根据视差图重建三维信息
实验2 OpenGL交互
在OpenGL中处理鼠标事件非常方便,GLUT已经为我们注册好了函数,只需要我们提供一个方法。使用glutMouseFunc函数,就可以注册自定义函数,这样当发生鼠标事件时就会自动调用自己定义的方法。 函数的原型是:
步行者08
2020/10/27
1.3K0
9.3.3编程实例-图形拾取
int select_point = 0; //1 是第一个点,2是第二个,以此类推
步行者08
2018/10/09
6690
OpenGL (一)--基于pod的OpenGL环境配置OpenGL (一)--基于pod的OpenGL环境配置
基于pod的OpenGL环境配置 依赖准备 ---- 所需依赖: CLTools glew libGLTools.a OpenGL.framework、GLUT.framework(这部分依赖于系统动
用户8893176
2021/08/09
1.5K0
OpenGL (一)--基于pod的OpenGL环境配置OpenGL (一)--基于pod的OpenGL环境配置
【C++】OpenGL:鼠标交互示例
另外,为了方便窗体中多边形移动,创建dx和dy两个全局变量,并分别加到多边形的各个顶点:
DevFrank
2024/07/24
1670
【C++】OpenGL:鼠标交互示例
win7 64位系统,vs2010下配置OpenGL开发环境
http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
流川疯
2019/01/18
9810
openGl超级宝典学习笔记 (1)第一个三角形「建议收藏」
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116433.html原文链接:https://javaforall.cn
全栈程序员站长
2022/07/07
4850
openGl超级宝典学习笔记 (1)第一个三角形「建议收藏」
OpenGl读取导入3D模型并且添加鼠标移动旋转显示
原文链接:https://www.cnblogs.com/DOMLX/p/11543828.html
徐飞机
2019/09/19
2.8K0
OpenGl读取导入3D模型并且添加鼠标移动旋转显示
10.4.3 编程实例-太阳系动画
glClearColor(0.0f, 0.0f, 0.0f, 0.8f); //背景为黑色
步行者08
2018/10/09
5050
图形学上机实验
可以将一个五角星划分为10个三角形,假设五角星的各边长,分别计算出10个定点的坐标,然后逐个绘制三角形,将其拼接为五角星;
客怎眠qvq
2022/11/01
1.6K0
图形学上机实验
用OpenGL实现粒子的随机运动
一、目的: 掌握OpenGL中粒子的绘制、随机数的使用 二、代码: #include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> //srand和rand #include <time.h> //time(int) const int N = 2000; float particles[N][3]; float rtri = 0; // 初始化材质属性、光源、光照模型、深度缓冲区 void init(void) { //材质反光
Zoctopus
2018/06/04
8200
OpenGL 中常用的 GLUT 函数库
这个函数用来初始化GLUT库。对应 main 函数的形式应是: int main(int argc,char* argv[]);
种花家的奋斗兔
2020/11/12
1.6K0
【C++】OpenGL:创建线段和多边形示例
首先,将main函数中的//glutDisplayFunc(lines); //传递需要勾画的函数取消注释,这是调用线段的操作;
DevFrank
2024/07/24
1080
【C++】OpenGL:创建线段和多边形示例
Linux下c++代码fwrite处出现段错误
GLuint load_texture(const char* fileName)
用户10182912
2022/11/11
5.6K1
Python绘制渐变色三角形
本文要点在于Python扩展库pyopengl的应用,关于OpenGL函数参数含义可以查阅有关资料。 import sys from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * class MyPyOpenGLTest: def __init__(self, width = 640, height = 480, title = b'OpenGL--gradient color'): glutI
Python小屋屋主
2018/04/16
1.5K0
Python绘制渐变色三角形
glPushMatrix和glPopMatrix的作用
终于明白为什么使用glPushMatrix()和glPopMatrix()的原因了。将本次需要执行的缩放、平移等操作放在glPushMatrix和glPopMatrix之间。glPushMatrix()和glPopMatrix()的配对使用可以消除上一次的变换对本次变换的影响。使本次变换是以世界坐标系的原点为参考点进行。下面对上述结论做进一步的解释:
全栈程序员站长
2022/07/22
5050
机械版CG 实验4 裁剪
了解二维图形裁剪的原理(点的裁剪、直线的裁剪、多边形的裁剪),利用VC+OpenGL实现直线的裁剪算法。
步行者08
2018/10/09
7670
相关推荐
实验8 OpenGL交互
更多 >
领券
💥开发者 MCP广场重磅上线!
精选全网热门MCP server,让你的AI更好用 🚀
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档