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 toDebug
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 .............
-
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 changeCMAKE_BUILD_TYPE
toRelease
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
toRelease
(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