Author Topic: Internal -O2 compiler flag for Release?  (Read 3144 times)

Offline Krice

  • Almost regular
  • **
  • Posts: 152
Internal -O2 compiler flag for Release?
« on: July 01, 2023, 12:30:11 pm »
I made a C++ project with only Release config, because I only need it. When compiling I noticed that there is -O2 flag even it's not set in build options. If you add something else like -O3 they are both included, you don't seem to be able to remove that -O2. Also, related observation is that if you set -s it's not included, but it also doesn't seem to make any difference if you add it in Other compiler options, the .exe doesn't get smaller. I guess this could be just that if you don't use debug information it's same as -s?

The C::B version is 20.03.
« Last Edit: July 01, 2023, 12:31:44 pm by Krice »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1644
Re: Internal -O2 compiler flag for Release?
« Reply #1 on: July 01, 2023, 01:37:27 pm »
You can set compiler options in three locations: the general compiler settings, the project compiler settings (general) and the project compiler options (target). The last two will be combined depending on your selection.

Offline Krice

  • Almost regular
  • **
  • Posts: 152
Re: Internal -O2 compiler flag for Release?
« Reply #2 on: July 01, 2023, 03:46:50 pm »
There was -O2 in the target setting... I was sure it was empty, but accidents happen. And -s is a linker setting, that's why you don't see it in the compiler command. I think it's easier to use only project settings, because the way you can combine them is quite confusing.