Configuration for optimizing QtCreator compiler

18,534

Solution 1

Try to add next lines to your .pro file:

# remove possible other optimization flags
QMAKE_CXXFLAGS_RELEASE -= -O
QMAKE_CXXFLAGS_RELEASE -= -O1
QMAKE_CXXFLAGS_RELEASE -= -O2 

# add the desired -O3 if not present
QMAKE_CXXFLAGS_RELEASE *= -O3

Solution 2

Add these line's to your .pro file if you want a small application size

QMAKE_CXXFLAGS += -Os -mpreferred-stack-boundary=2 -finline-small-functions -momit-leaf-frame-pointer

If you want a faster application , consider using -O2 instead of -Os

refer this for more options

Share:
18,534
batista cori
Author by

batista cori

Updated on June 02, 2022

Comments

  • batista cori
    batista cori about 2 years

    I'm using QtCreator in Windows 7.

    I want to configure it to use third level optimization (-O3) for c++ compiler.

    How can I do this to speed up my code and what changes are necessary?

  • batista cori
    batista cori over 11 years
    I did it. But I can't see any improvement. Maybe I should think about rebuilding Qt with -O3