QtOpengl conflict with Opengl framwork on mac



  • I am trying to merge cocos2d-x 3.12 and Qt 5.7 together and was keep getting the conflict error message when linking:

    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);
    

    I tried to remove the Opengl Framework in .pro file like this :

    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
    

    But it was not working, still the same error.

    Any advice will be appreciated, thanks :)


  • Lifetime Qt Champion

    Hi,

    Looks rather like cocos2d-x is doing something funky here. You should comment that line since glDepthRangef is provided by the current OS X SDK.



  • @SGaist Thanks for your reply, I commented out the 2 lines in one file and now it compiled and linked fine.

    I am able to run the app now but was having some problems I thought might be related to this modification ?

    I have posted it here, may be you will be have time to have a look:

    https://forum.qt.io/topic/69286/cocos2dx-in-qt-weird-crash-problem


  • Lifetime Qt Champion

    Good !

    In that case, please mark the thread as solved using the "Topic Tools" button so that other forum members may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.