我正在尝试将cocos2d-x 3.12和Qt 5.7合并在一起,并且在链接时不断收到冲突错误消息:
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,如下所示:
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但是它没有工作,仍然是同样的错误。
任何建议都将不胜感激,谢谢:)
发布于 2016-07-14 19:57:29
我假设这个错误是由于Qt重写glew.h或GL.h提供的与OpenGL相关的宏定义的策略造成的。其他人也试图解决这个问题,但遇到了类似的问题(例如GLEW and Qt5 redefinition of headers)。解决方法是避免在同一个文件中包含GL.h/glew.h和任何与OpenGL相关的Qt头文件。
https://stackoverflow.com/questions/38350616
复制相似问题