首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >QtOpengl与mac上的Opengl框架冲突

QtOpengl与mac上的Opengl框架冲突
EN

Stack Overflow用户
提问于 2016-07-13 19:35:50
回答 1查看 390关注 0票数 0

我正在尝试将cocos2d-x 3.12和Qt 5.7合并在一起,并且在链接时不断收到冲突错误消息:

代码语言:javascript
复制
In file included from Qt5.7.0/5.7/clang_64/lib/QtOpenGL.framework/Headers/QGLWidget:1:
In file included from Qt5.7.0/5.7/clang_64/lib/QtOpenGL.framework/Headers/qgl.h:45:
In file included from Qt5.7.0/5.7/clang_64/lib/QtGui.framework/Headers/qopengl.h:124:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:2704:21: error: conflicting types for 'glDepthRange'
GLAPI void APIENTRY glDepthRangef (GLclampf n, GLclampf f);
                    ^
demo/cocos2d-x/cocos/platform/mac/CCGL-mac.h:43:41: note: expanded from macro 'glDepthRangef'
#define glDepthRangef                   glDepthRange
                                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1662:21: note: previous declaration is here
GLAPI void APIENTRY glDepthRange (GLclampd near, GLclampd far);

我尝试删除.pro文件中的Opengl Framework,如下所示:

代码语言:javascript
复制
QT       += core gui opengl

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = QtApplication
TEMPLATE = app

#INCLUDEPATH += /usr/local/include
#LIBS += -L/usr/local/lib/ -lGLEW
LIBS += -L/usr/local/lib/ -lz
LIBS += -L/usr/local/lib/ -lcurl

LIBS    += -framework Cocoa
LIBS    += -framework Foundation
LIBS    += -framework OpenAL
LIBS    += -framework IOKit
LIBS    += -framework CoreVideo
LIBS    += -framework OpenGL

但是它没有工作,仍然是同样的错误。

任何建议都将不胜感激,谢谢:)

EN

回答 1

Stack Overflow用户

发布于 2016-07-14 19:57:29

我假设这个错误是由于Qt重写glew.h或GL.h提供的与OpenGL相关的宏定义的策略造成的。其他人也试图解决这个问题,但遇到了类似的问题(例如GLEW and Qt5 redefinition of headers)。解决方法是避免在同一个文件中包含GL.h/glew.h和任何与OpenGL相关的Qt头文件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38350616

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档