Adding -O3 compiler option in Qt Creator
Hello!
I'm using MinGW and GCC for my Qt projects and I want to add the compiler option -O3 to optimize my code. I thought that the place to add compiler options was in Projects->Make->Make arguments, where I successfully already added the -j compiler option, but this time it doesn't work no matter how I try to insert -O3 there.
Should I put it in another place? And if not, how exactly to do it?
Thanks,
Momergil
Re: Adding -O3 compiler option in Qt Creator
You should be able to do it via .pro file:
Code:
QMAKE_CXXFLAGS += -O3
Re: Adding -O3 compiler option in Qt Creator
Quote:
Originally Posted by
stampede
You should be able to do it via .pro file:
Code:
QMAKE_CXXFLAGS += -O3
Thanks stampede for the reply. Although I'm not sure it's working, at least now it's not giving me any compiler errors!!
Momergil
Re: Adding -O3 compiler option in Qt Creator
You can always check the command used to invoke the compiler, eg
Code:
g++ -c -O3 -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPO
RT -DQT_DLL -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNO
W -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I'../../../
../Qt/include/QtCore' -I'../../../../Qt/include/QtGui' -I'../../../../Qt/include
/QtSql' -I'../../../../Qt/include' -I'.' -I'../../../../Qt/include/ActiveQt' -I'
debug' -I'../../../../Qt/mkspecs/default' -o debug/main.o main.cpp
You can see the -O3 flag added to compiler options.
Btw. it worked with the -j switch, because -j is the make command option, whereas "-O3" is the compiler option.
Re: Adding -O3 compiler option in Qt Creator
Thanks for the tip and for the explanation! :)
Momergil