Including a QT header into a souce file that is outside of the project tree causes compiler errors.



  • If I add

    #include <QOpenGLTexture>
    

    into my QML project I got errors of type '<something1> must be included before any header file that defines <something1>', for example:

    libs/qt591/include/QtCore/qtextstream.h:52: error: #error qtextstream.h must be included before any header file that defines Status
    #error qtextstream.h must be included before any header file that defines Status
    ^~~~~

    This something2 can be Status, Bool or something else, depending on where I include <QOpenGLTexture>. Tried to make <QOpenGLTexture> the first include file in my sources, but with no success.

    I use QT 5.9.1.

    This happens if I include any qt header like <QDebug> for example into a header that is outside of the project tree.


  • Lifetime Qt Champion

    Hi,

    Can you show your project tree ?



  • @SGaist in the PRO file I have this:

    QT += qml quick multimedia

    CONFIG += c++11

    VERSION = 1.0.14
    #Enable OpenGL function definitions in the GL headers
    DEFINES += GL_GLEXT_PROTOTYPES VERSION_STRING=\"$$VERSION\"

    INCLUDEPATH += ../MyApp/MyApp.Shared ../../../lib/Awl

    SOURCES += main.cpp
    Util/QtAssetStorage.cpp
    Util/QtAssetStream.cpp
    Util/QtFileSystem.cpp
    Util/QtPlatformCapabilities.cpp
    Util/QtSysUtil.cpp
    ../MyApp/MyApp.Shared/Animation/Animation.cpp
    ../MyApp/MyApp..Shared/Animation/RotationAnimation.cpp
    ../MyApp/MyApp.Shared/Geometries/ArrowGeometry.cpp
    ....

    if I include a QT header in a file in a ../MyApp/MyApp.Shared/ subfolder I get this.


  • Lifetime Qt Champion

    Is this some kind of library you are using ?



  • @SGaist it is not a library, but it is a shared sources that I use with my QT project and a UWP project that I compile with MSVS 2015.


Log in to reply
 

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