Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtCreator not compiling forms



  • Re: How can I disable the shadow builds perpetually?

    I cannot get QtCreator to compile or update my forms even though shadow building is disabled.
    If I update the layout form and rebuild all, the changes do not ripple to the compiled code nor the form.h file.
    I'm using Qt Creator 4.9.2
    Thanks,
    Phil



  • @montanaviking could you please show your .pro file?



  • Hi and thanks!
    ###########################################################
    QT += core gui sql widgets

    TARGET = sql_Qtcreator
    TEMPLATE = app

    The following define makes your compiler emit warnings if you use

    any feature of Qt which has been marked as deprecated (the exact warnings

    depend on your compiler). Please consult the documentation of the

    deprecated API in order to know how to port your code away from it.

    DEFINES += QT_DEPRECATED_WARNINGS

    You can also make your code fail to compile if you use deprecated APIs.

    In order to do so, uncomment the following line.

    You can also select to disable deprecated APIs only up to a certain version of Qt.

    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

    CONFIG += c++17

    SOURCES +=
    ActionTable.cpp
    Paper_Model.cpp
    Sql.cpp
    SqlTableView.cpp
    columncombobox.cpp
    logic.cpp
    main.cpp
    sqlForeignKeyDelegate.cpp

    HEADERS +=
    ActionTable.h
    Paper_Model.h
    Sql.h
    SqlTableView.h
    columncombobox.h
    constants.h
    sqlForeignKeyDelegate.h
    library.h
    sqlsetup.h

    FORMS +=
    library.ui

    Default rules for deployment.

    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    ################################################################

    Removal of the library.h file results in a linker error because library.h is not being automatically generated from library.ui.
    I have attempted to clean all and rebuild but apparently uic is not automatically running so library.h is not being generated.
    This is running on Ubuntu 18.04 64 bit.
    Thanks again!
    Phil



  • Thanks for bearing with me. It appears I found the problem in that I had misnamed the include file that uic was actually producing. uic was producing a different include filename and I had not included that in my .pro file. Instead, I had included library.h in my .pro file when the correct name is ui_library.h
    Thanks,
    Phil



  • @montanaviking ui_library.h doesn't need to be included.
    You should only #include "ui_library.h" in your c++ file where your ui is being used (this is usually done automatically by Qt master when you create new class with form).
    ui_*.h are generated and should not be included to .pro file, otherwise qmake will fail on first start, being unable to find the file you specified but not created yet.


Log in to reply