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

Project tree changes when switching from debug to release mode



  • Hi,

    I'm getting a strange behavior that I've never seen before on the project tree. I'm using MacOs 10.13.6 and Qt 5.12.2 clang64 and I want to start my program in release mode, but I get an error while compiling:
    Schermata 2020-01-20 alle 10.10.04.png

    In debug mode I never get this error and the function used by the helper.js file that is missing are working properly. So I looked at the project view to be sure the file was included in the Project Tree and I found this difference between debug and release mode:
    Release mode:
    Schermata 2020-01-20 alle 10.03.42.png
    Debug mode:
    Schermata 2020-01-20 alle 10.03.28.png

    So I suppose that the error is due to this behavior, am I right? But why does the project tree change when switching between debug and release mode? How can I avoid this? Or do I have to specify the differences in the path in some way?

    Thanks in advance!



  • After a lot of attempts I manage to build my project in release mode using a workaround, but I don't really know if it's something safe.

    In build settings->Release I disabled the flag "Enable Qt Quick Compiler" since it's disabled also in release mode.

    From what I can see the application is working correctly and is not giving me any problem.


  • Lifetime Qt Champion

    @davidesalvetti Did you try a complete clean rebuild after switching to Debug mode? Delete build directory, run qmake and then build.



  • @jsulm Thanks for your answer. I try to do exactly what you said, but the build step still generates that error and the project tree still changes when switching between the two mode.

    This is my Graphs.pri file:

    INCLUDEPATH += $$PWD
    
    SOURCES += \
        $$PWD/allarmpannel.cpp \
        $$PWD/colorrange.cpp \
        $$PWD/insertintermediates.cpp \
        $$PWD/qchartviewer.cpp \
        $$PWD/chartsaxis.cpp \
        $$PWD/chartsettings.cpp \
        $$PWD/addchannel.cpp \
        $$PWD/baseviewport.cpp
        $$PWD/stackedalarmpanel.cpp \
        $$PWD/chartzoom.cpp \
        $$PWD/tablewidget.cpp 
    
    HEADERS += \
        $$PWD/allarmpannel.h \
        $$PWD/colorrange.h \
        $$PWD/insertintermediates.h \
        $$PWD/qchartviewer.h \
        $$PWD/chartsaxis.h \
        $$PWD/chartsettings.h \
        $$PWD/addchannel.h \
        $$PWD/baseviewport.h \
        $$PWD/stackedalarmpanel.h \
        $$PWD/chartzoom.h \
        $$PWD/tablewidget.h 
    
    FORMS += \
        $$PWD/allarmpannel.ui \
        $$PWD/colorrange.ui \
        $$PWD/insertintermediates.ui \
        $$PWD/chartsaxis.ui \
        $$PWD/chartsettings.ui \
        $$PWD/addchannel.ui \
        $$PWD/baseviewport.ui \
        $$PWD/stackedalarmpanel.ui \
        $$PWD/chartzoom.ui 
    
    RESOURCES += \
        $$PWD/qmlmap.qrc
    
    

    and in the qmlmap.qrc there is the helper.js that gives the error.

    In my .pro file the Graphs.pri is included as following:

    include(Graphs/Graphs.pri)
    

    I never got problems like this on windows, It's the first time they came up.

    I forget to mention that the file "helper.js" is used in a qml file called Map.qml inside the resources and it's imported into the file like this:

    import "helper.js" as Helper
    

    In debug mode the project tree of the Resource inside the Grapth.pri is the following:
    Schermata 2020-01-20 alle 15.58.31.png

    while in release mode the Resource folder of Graph.pri disappears and I've just seen that appears in the sources folder:
    Schermata 2020-01-20 alle 16.02.08.png


  • Lifetime Qt Champion

    Hi,

    Can you try build from the command line directly ?



  • @SGaist yes of course. I deleted the release folder and on the command line I have executed the following commands:

    Schermata 2020-01-21 alle 09.34.02.png

    It has just created the release folder and the makefile but no .app file or something else, but it doesn't give any error. That's strange, what am I missing?

    My start directory on the command line is : /Users/developer/Qt/5.12.2/clang_64/bin just to be clear.

    Thanks again.


  • Lifetime Qt Champion

    This post is deleted!

  • Lifetime Qt Champion

    Two things I can see:

    • you just configured your project to build in the folder containing qmake
    • it's make -C when you want to call make on a specific folder.


  • After a lot of attempts I manage to build my project in release mode using a workaround, but I don't really know if it's something safe.

    In build settings->Release I disabled the flag "Enable Qt Quick Compiler" since it's disabled also in release mode.

    From what I can see the application is working correctly and is not giving me any problem.


Log in to reply