我正在尝试将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
但它没有用,仍然是同样的错误。
任何建议都将不胜感激,谢谢:)
答案 0 :(得分:1)
我认为这个错误是由于Qt的政策覆盖了glew.h或GL.h提供的与OpenGL相关的宏定义。其他人试图解决这个问题并遇到类似的问题(例如GLEW and Qt5 redefinition of headers)。让我这样做的解决方法是避免在同一个文件中包含GL.h / glew.h和任何与OpenGL相关的Qt头。