Configuration for optimizing QtCreator compiler

纵饮孤独 提交于 2019-12-06 20:19:11

问题


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?


回答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



回答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



来源:https://stackoverflow.com/questions/12785364/configuration-for-optimizing-qtcreator-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!