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

Qt Creator: Release mode is also set to Debug, can't run in Release



  • I'm using Qt Creator 4.11.0 Based on Qt 5.12.8 (GCC 9.3.0, 64 bit) on Linux Mint
    I noticed the performance of my program is worse than expected, and then I realised there was no difference in performance between Release and Debug mode.

    I went to Proejcts->Build and saw that CMAKE_BUILD_TYPE is set to Debug even on Release mode. I tried to change it to Release but it kept changing it back to Debug.
    In visual studio on my Windows setup I get 0.01ms per operation on Release mode and 0.5ms on Debug mode, but in Qt Creator on my Linux setup I get 0.5ms in both Release and Debug so I assume this is the issue (both are tested on the same computer)

    How can I ensure Release is actually running in Release when I select it in the bottom left before running?

    Here's my CMakeLists file:

    cmake_minimum_required(VERSION 3.5)
    
    project(RubiksCubeSolver)
    
    set(SRC "${CMAKE_SOURCE_DIR}/main.cpp"
            .............
            .............
    
    add_executable(RubiksCubeSolver ${SRC})
    
    # C++20 required
    set_property(TARGET RubiksCubeSolver PROPERTY CXX_STANDARD 20)
    set_property(TARGET RubiksCubeSolver PROPERTY CXX_STANDARD_REQUIRED ON)
    
    # irrelevant SDL2 stuff
            .............
    


  • @NULL

    You need to reconfig your builds in QtCreator. Check your Release configuration.

    Btw this:

    Qt Creator 4.11.0 Based on Qt 5.12.8 (GCC 9.3.0, 64 bit)

    is how your QtCreator was build. It does not show the Qt version you are using ;-)



  • @Pl45m4
    Thank you for answering
    If you're referring to this: https://doc.qt.io/qtcreator/creator-build-settings.html#cmake-build-configuration, then I already tried to change CMAKE_BUILD_TYPE to Release and set the -03 optimisations, but it just reverts back to the previous values after.
    If it's not what you meant, could you explain?



  • @NULL said in Qt Creator: Release mode is also set to Debug, can't run in Release:

    I already tried to change CMAKE_BUILD_TYPE to Release

    Have you changed it from Debug to Release (the dropdown on the top left)?
    I assume you tried to edit the current debug config. Then it will revert the changes. You need to edit the release build config and if there isn't any, you ned to create a new one (or clone the current one and then make your changes).

    Qt Creator creates an initial configuration for you based on the kit settings and displays it in the Initial CMake parameters field

    It seems that you have the initial config which was created by QtCreator



  • @Pl45m4
    Edit: the problem is I changed the Build directory. When I keep it on the default path it works as expected. Any idea why?


Log in to reply