OpenGL圣经第五版代码问题
我看过 2 个帖子提出了同样的问题,但其中一个是 Visual Studio 的,另一个不起作用,所以这里是。我正在尝试编译开篇圣经第五版附带的第一个源代码...但我正在尝试使用 code::blocks ide 来完成此操作。 我以为我已经正确安装了 freeglut(因为我可以运行 C::B 附带的 glut 程序),但是我从 glut 和 glu 中收到了许多错误......在我认为我解决了这些问题之后,现在我收到了超过 50 个错误我不知道是什么原因造成的。 错误看起来像这样
obj\Debug\main.o(.text+0x2eb):C:\Users|20|undefined reference to `GLShaderManager::~GLShaderManager()'|
C:\Users\t\main.cpp|27|undefined reference to
glViewport@16'|`
所有错误都非常相似,但未定义的引用更改为另一个 OpenGL 函数。
任何帮助将不胜感激,只需询问您是否需要源代码或更多错误。
编辑
将 glu32 添加到链接器后,它消除了与此相关的所有错误 但我的 freeglut 安装似乎有问题,我收到错误
obj\Debug\main.o(.text+0x1c)||In function `glutInit_ATEXIT_HACK':|
freeglut_std.h|610|undefined reference to `_imp____glutInitWithExit@12'|
obj\Debug\main.o(.text+0x3f)||In function `glutCreateWindow_ATEXIT_HACK':|
freeglut_std.h|612|undefined reference to `_imp____glutCreateWindowWithExit@8'|
obj\Debug\main.o(.text+0x61)||In function `glutCreateMenu_ATEXIT_HACK':|
freeglut_std.h|614|undefined reference to `_imp____glutCreateMenuWithExit@8'|
解决了 free glut 问题...我必须使用不同的库文件...我从 此处
编辑 2
我现在已经开始工作了,这本书使用的自定义库给了我一个错误...我相信这是因为我正在尝试使用 .lib 文件(这就是它的样子),这可能是我所有的错误... C::B 可以链接 .lib 文件还是只需要 .a 和 .o 文件作为库?
I have seen 2 posts with this same question but one was with visual studio and the other didn't work so here goes. i am attempting to compile the first source code that comes with the opening bible 5th edition...but i am trying to do so with the code::blocks ide.
i thought i had freeglut installed correctly(as i can run the glut program that comes with C::B) but i am getting numerous errors from glut and glu...and after i thought i fixed those problems now im getting over 50 error and i have no idea what is causing them.
the error look like this
obj\Debug\main.o(.text+0x2eb):C:\Users|20|undefined reference to `GLShaderManager::~GLShaderManager()'|
C:\Users\t\main.cpp|27|undefined reference to
glViewport@16'|`
all the error are very similar but the undefined reference changes to another OpenGL function.
any help would be appreciated and just ask if you need the source code or more error.
EDIT
after adding glu32 to the linker it got rid of all error regarding that
but there appear to be a problem with my freeglut installation i am getting error
obj\Debug\main.o(.text+0x1c)||In function `glutInit_ATEXIT_HACK':|
freeglut_std.h|610|undefined reference to `_imp____glutInitWithExit@12'|
obj\Debug\main.o(.text+0x3f)||In function `glutCreateWindow_ATEXIT_HACK':|
freeglut_std.h|612|undefined reference to `_imp____glutCreateWindowWithExit@8'|
obj\Debug\main.o(.text+0x61)||In function `glutCreateMenu_ATEXIT_HACK':|
freeglut_std.h|614|undefined reference to `_imp____glutCreateMenuWithExit@8'|
solved free glut problem...i had to use different library files.... i got them from here
Edit 2
i got freeglut working by now the custom library that the book used is giving me an error...i belive this is becouse i am attempting to use a .lib file (which is what it came as) this might have been the source of all my errors...can C::B link .lib files or does it only take .a and .o files for library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须添加适当的库才能链接。
对于 C::B,
回复您的编辑:
按照此处的步骤操作:http://www. sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/
You have to add proper libraries to link against with.
For C::B,
Response to your EDIT:
Follow the steps in here: http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/