Qt World Summit: Register Today!

QtCreator project with folder named new

  • I noticed a strange behaviour with qmake, using Qtcreator.
    I have a project with many files allocated in different folders.
    One of these folders is named "new".
    The strange thing is, every time I edit some file located in this folder,
    the whole project is recompiled, instead of recompiling only the edited file (.cpp file).

    Changing other files on other folders, the behaviour is correct.
    Renaming the new folder, solve the problem.

    A non-Qt project does't have this issue.

    Actually I am using Qt5.7.1 with MinGW 5.3.0 on windows7.

    It is very easy to reproduce.
    Create a new Qt project.
    Add a new file and put it in a folder named new.
    After compiling the whole project, try to change the new added file.

    is it a known problem?

    Thank you for any hint

  • Lifetime Qt Champion

    It's not something I have seen reported before.
    Also, i tried to reproduce in a new project using
    your step by step but it only compiles test.cpp in the new folder.

    Could you perhaps post your .pro file?

  • Thanks for the replay.

    This is my .pro file without any change, copied and pasted.

    # Project created by QtCreator 2019-03-19T15:43:18
    QT       += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = prova_new
    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.
    # 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++11
    SOURCES += \
            main.cpp \
            mainwindow.cpp \
    HEADERS += \
            mainwindow.h \
    FORMS += \
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target

  • Lifetime Qt Champion

    Well, it looks exactly like my test one.
    What do you have in dummy.h / cpp ?
    Also are they include in mainwindow or main ?

    it could be a bug in Qt5.7.1 as im testing with Qt5.12

    You must use such older version ?

  • In dummy.h and dummy.cpp, (nothig special)

    #ifndef DUMMY_H
    #define DUMMY_H
    class Dummy
    #endif // DUMMY_H
    #include "dummy.h"


    #include "mainwindow.h"
    #include <QApplication>
    int main(int argc, char *argv[])
        QApplication a(argc, argv);
        MainWindow w;
        return a.exec();

    My project is an application that we use at work and many users have Windows XP.
    Unfortunately, Qt5.12 is not compatible with Windows XP.

  • Lifetime Qt Champion

    Ahh, the good old Windows XP. Not as stoned dead as they want to believe :)
    I would check https://bugreports.qt.io/issues/ to see if it has been reported.
    Your pro file look pretty normal.

    Its only when folder is named new ?

  • If I rename new folder in new_old, for example, the problem disappears.
    I also tried, Qt5.8, already installed in my system, same problem.

    Maybe tomorow, I will try Qt5.12 and let you know.

Log in to reply