News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Internal -O2 compiler flag for Release?

Started by Krice, July 01, 2023, 12:30:11 PM

Previous topic - Next topic

Krice

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.

Miguel Gimenez

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.

Krice

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.