Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator: Release mode is also set to Debug, can't run in Release
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NULL
    wrote on 15 Mar 2021, 12:24 last edited by NULL
    #1

    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
            .............
    
    P 1 Reply Last reply 15 Mar 2021, 13:33
    0
    • N NULL
      15 Mar 2021, 12:24

      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
              .............
      
      P Offline
      P Offline
      Pl45m4
      wrote on 15 Mar 2021, 13:33 last edited by
      #2

      @NULL

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

      • https://doc.qt.io/qtcreator/creator-build-settings.html

      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 ;-)


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      N 1 Reply Last reply 15 Mar 2021, 13:43
      0
      • P Pl45m4
        15 Mar 2021, 13:33

        @NULL

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

        • https://doc.qt.io/qtcreator/creator-build-settings.html

        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 ;-)

        N Offline
        N Offline
        NULL
        wrote on 15 Mar 2021, 13:43 last edited by
        #3

        @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?

        P 1 Reply Last reply 15 Mar 2021, 13:49
        0
        • N NULL
          15 Mar 2021, 13:43

          @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?

          P Offline
          P Offline
          Pl45m4
          wrote on 15 Mar 2021, 13:49 last edited by Pl45m4
          #4

          @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


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          N 1 Reply Last reply 15 Mar 2021, 14:04
          0
          • P Pl45m4
            15 Mar 2021, 13:49

            @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

            N Offline
            N Offline
            NULL
            wrote on 15 Mar 2021, 14:04 last edited by NULL
            #5

            @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?

            1 Reply Last reply
            0

            1/5

            15 Mar 2021, 12:24

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved