获取有关重定义的错误(OpenGL 4.0 Shading Language Cookbook) [英] Get errors about redefinition (OpenGL 4.0 Shading Language Cookbook)

查看:899
本文介绍了获取有关重定义的错误(OpenGL 4.0 Shading Language Cookbook)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚测试了第1章中的代码( OpenGL 4.0 Shading Language Cookbook

I just tested the code in chapter 1 (OpenGL 4.0 Shading Language Cookbook)

我安装了Qt5,qmake -tp vc chapter01.pro,然后在vs2010中打开。

I have installed Qt5, qmake -tp vc chapter01.pro then open it in vs2010.

例如:

1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(38): error C2371: 'GLintptr' : redefinition; different basic types
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(1615) : see declaration of 'GLintptr'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(39): error C2371: 'GLsizeiptr' : redefinition; different basic types
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(1614) : see declaration of 'GLsizeiptr'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(96): warning C4005: 'GL_BLEND_EQUATION_RGB' : macro redefinition
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(1666) : see previous definition of 'GL_BLEND_EQUATION_RGB'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(474): error C2365: '__glewActiveTexture' : redefinition; previous definition was 'data variable'
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(12027) : see declaration of '__glewActiveTexture'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(475): error C2365: '__glewAttachShader' : redefinition; previous definition was 'data variable'

如何解决这些问题? (代码链接为此处

How to solve these problems? (The code link is here)

推荐答案

不是最好的答案肯定,但我刚刚检查了这本书。

Not a best answer for sure, but I've just checked the book.

当您使用Qt的版本时,这本书似乎过时了:

It seems that book is outdated when you get to Qt's version:


例如,在最近的Qt版本(至少版本4.7)

For example, in recent versions of Qt (at least version 4.7)

因此,为了方便阅读本书,考虑将Qt降级到4.x(例如4.8)家族,因为OpenGl需求可能有很多变化,尤其是如果你使用的Qt build是用不同的OpenGl库构建的。

So, for the sake of easy reading the book, you may consider to downgrade your Qt to 4.x (4.8, for example) family, as there may be a lot of changes in the OpenGl requirements, especially if Qt build you are using is built with different OpenGl libraries.

另一个解决方案是使用更新的源代码,不需要Qt at all:

Another solution is to use updated source code which doesn't require Qt at all:


这是来自OpenGL 4.0 Shading Language Cookbook的示例程序,David Wolff。源代码已更新为使用MS Visual Studio,不再需要Qt。

This is the example programs from the OpenGL 4.0 Shading Language Cookbook, by David Wolff. The source code has been updated to work with MS Visual Studio, and no longer requires Qt.

这篇关于获取有关重定义的错误(OpenGL 4.0 Shading Language Cookbook)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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