GLUT编译错误与Code ::块 [英] GLUT compile errors with Code::Blocks

查看:789
本文介绍了GLUT编译错误与Code ::块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一周前,当我第一次尝试与GLUT合作,并遵循这个教程它没有任何错误工作。
现在,一个星期后,我安装了相同的软件,相同的库,但每次我尝试编译项目,我得到这些错误(它突出了一行在glut.h文件):

A week ago, when I first tried to work with GLUT and followed this tutorial it worked without any errors. Now, a week later I installed the same software, same libraries, but every time I try to compile the project I get these errors (and it highlights a line in the glut.h file):

obj\Debug\main.o(.text+0x1c)||In function `glutInit_ATEXIT_HACK':|
C:\Program Files\CodeBlocks\MinGW\include\GL\glut.h|486|undefined reference to `__glutInitWithExit@12'|
obj\Debug\main.o(.text+0x3d)||In function `glutCreateWindow_ATEXIT_HACK':|
C:\Program Files\CodeBlocks\MinGW\include\GL\glut.h|503|undefined reference to `__glutCreateWindowWithExit@8'|
obj\Debug\main.o(.text+0x5d)||In function `glutCreateMenu_ATEXIT_HACK':|
C:\Program Files\CodeBlocks\MinGW\include\GL\glut.h|549|undefined reference to `__glutCreateMenuWithExit@8'|

我卸载了代码:Blocks,删除了GLUT文件(glut.h,glut32.dll, a)并重新安装一切,但我仍然得到相同的错误。
我完全确定我的链接器设置是OK,因为我遵循了教程。我也尝试过其他教程,但得到相同的结果,一堆错误。

I uninstalled Code:Blocks, deleted the GLUT files (glut.h, glut32.dll, glut.a) and reinstalled everything, but I still get the same errors. I'm completely sure my linker settings are OK since I've followed the tutorial. I also tried other tutorials, but get the same results, a bunch of errors.

我做错了什么,如何解决它?

What am I doing wrong, and how can I fix it?

编辑:修正!在包括 GL / glut.h 之前需要 #include / p>

Fixed! All that was needed was #include <GL/gl.h> before including GL/glut.h.

推荐答案

我必须添加 #include< GL / gl.h> #include< GL / glut.h> 之前。我不知道为什么,但现在所有的示例代码,我检查工作,如果这样做。

I had to add #include <GL/gl.h> before #include <GL/glut.h>. I'm not sure why, but now all example codes I checked work if I do so.

这篇关于GLUT编译错误与Code ::块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆