QWidget can't be found in file included by INCLUDEPATH in pro file



  • When I build project I end up with such error:
    @/Developer/usr/bin/g++ -c -pipe -O2 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -Wall -W -fPIC -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DDTT_DLL -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/local/Qt-5.3.2/mkspecs/macx-g++ -I. -Iinclude -I../thirdparty/log4qt -Isrc1 -I/usr/local/Qt-5.3.2/lib/QtWidgets.framework/Versions/5/Headers -I/usr/local/Qt-5.3.2/lib/QtXml.framework/Versions/5/Headers -I/usr/local/Qt-5.3.2/lib/QtNetwork.framework/Versions/5/Headers -I/usr/local/Qt-5.3.2/lib/QtGui.framework/Versions/5/Headers -I/usr/local/Qt-5.3.2/lib/QtCore.framework/Versions/5/Headers -Irelease -I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AGL.framework/Headers -Irelease -F/usr/local/Qt-5.3.2/lib -o release/ApiNetworkAccessManager.o src/core/apiclient/ApiNetworkAccessManager.cpp
    /Developer/usr/bin/g++ -pipe -O2 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -Wall -W -fPIC -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DDTT_DLL -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB src1/qtvariantproperty.cpp -o src1/qtvariantproperty
    In file included from src1/qtvariantproperty.h:45,
    from src1/qtvariantproperty.cpp:42:
    src1/qtpropertybrowser.h:45:29: error: QtWidgets/QWidget: No such file or directory@

    where ApiNetworkAccessManager is file contained by project and qtpropertybrowser as well as qtvariantproperty were included by INCLUDEDPATH in pro file. What is strange is that frameworks are only used in building of ApiNetworkAccessManager but not for qtvariantproperty.

    does anybody knows where could be a problem?

    my pro file:
    @TEMPLATE = lib
    TARGET = imsCommon
    DESTDIR = ../lib
    QT += network xml widgets
    CONFIG += debug_and_release x86 x86_64
    DEFINES += QT_XML_LIB QT_NETWORK_LIB QT_SCRIPT_LIB DTT_DLL
    INCLUDEPATH += ./include
    ./../thirdparty/log4qt
    ./src1
    LIBS += -L"./../lib"

    CONFIG(debug, debug|release) {
    UI_DIR = debug
    TARGET = $$join(TARGET,,,d)
    LIBS += -llog4Qtd
    -lQtSolutions_PropertyBrowser-2.5d
    }
    else {
    UI_DIR = release
    LIBS += -llog4Qt
    -lQtSolutions_PropertyBrowser-2.5
    }

    #Include file(s)
    include(imsCommon.pri)

    #Windows resource file
    win32:RC_FILE = imsCommon.rc

    macx{
    QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/
    LIBS += -framework QuickTime -framework Carbon
    }@



  • What if in src1/qtpropertybrowser.h instead of
    @
    #include "QtWidgets/QWidget"
    @

    you will use
    @
    #include "QWidget"
    @



  • Same error. Here is problem that frameworks are missing during complilation of qtvariantproperty. If I include <QtWidgets/QWidget> in ApiNetworkAccessManager.h everything is ok



  • Compile command line for qtvariantproperty.cpp looks different than for ApiNetworkAccessManager.cpp. It does not include any -I options.
    And I don't see any SOURCES, HEADERS keywords in your .pro file.

    How so you include the sources and the headers in the project?



  • They are listed in imsCommon.pri file.

    If I examine makefile.release I have there :

    @release/moc_InfoFieldEditorFactory.cpp: src1/qtvariantproperty.h
    src1/qtpropertybrowser.h
    /usr/local/Qt-5.3.2/lib/QtCore.framework/Versions/5/Headers/QHash
    /usr/local/Qt-5.3.2/lib/QtCore.framework/Versions/5/Headers/qhash.h
    /usr/local/Qt-5.3.2/lib/QtWidgets.framework/Versions/5/Headers/QTreeWidgetItem
    /usr/local/Qt-5.3.2/lib/QtWidgets.framework/Versions/5/Headers/qtreewidget.h
    include/gui/InfoFieldEditorFactory.h
    /usr/local/Qt-5.3.2/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.3.2/mkspecs/macx-g++ -I/Users/pka/DesktopTools/TeamEdition_Qt5/imsCommon -I/Users/pka/DesktopTools/TeamEdition_Qt5/imsCommon/include -I/Users/pka/DesktopTools/TeamEdition_Qt5/thirdparty/log4qt -I/Users/pka/DesktopTools/TeamEdition_Qt5/imsCommon/src1 -I/usr/local/Qt-5.3.2/lib/QtWidgets.framework/Headers -I/usr/local/Qt-5.3.2/lib/QtXml.framework/Headers -I/usr/local/Qt-5.3.2/lib/QtNetwork.framework/Headers -I/usr/local/Qt-5.3.2/lib/QtGui.framework/Headers -I/usr/local/Qt-5.3.2/lib/QtCore.framework/Headers -I/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1 -I/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64 -I/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/backward -I/Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1/include -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -F/usr/local/Qt-5.3.2/lib include/gui/InfoFieldEditorFactory.h -o release/moc_InfoFieldEditorFactory.cpp@

    If I understood it right.. also comparing with other compilation commands.. after each file, there should be list of used qt headers but this list misses for qtvariantproperty and qtpropertybrowser. It seems like there were not analyzed at all. QHash and QTreeWidgetItem are headers defined in InfoFieldEditorFactory.h



  • src1/qtvariantproperty.cpp is listed under SOURCES and src1/qtvariantproperty.h is listed under HEADERS in imsCommon.pri. Is it right?

    Did you try to re-run qmake after you added src1/qtvariantproperty.cpp ?

    What if you create simple widget project and add qtvariantproperty.cpp, .h and try to build it ?



  • No qtvariantproperty.cpp/h are included with INCLUDEPATH as you can see it in pro file.

    I build project from command line where everytime qmake is called. So yes I did.

    I can try it with simple project. Tomorrow. But for now it seems to me like qmake treats different project files and files included via INCLUDEPATH keyword



  • qmake uses SOURCES to create correct command line to compile the sources.
    Try to add qtvariantproperty.cpp to SOURCES in your .pro file

    @
    SOURCES += src1/qtvariantproperty.cpp
    @



  • The thing is that qtvariantproperty and qtpropertybrowser are already built in library QtSolutions_PropertyBrowser-2.5. I want to include just header files, so I can use functionality implemented in that dll as it woult be in ImsCommon library. I don't want to build them in this project again..



  • problem disappeared after downloading fresh project from repository


Log in to reply
 

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