PDA

View Full Version : How can we add -O2 flag into .pro file?



learning_qt
2nd November 2009, 11:23
Hello,

I hope add -O2 optimization flag to the .pro file and I did like this:
QMAKE_CXXFLAGS += -o2

But it seems that the Makefile still use -o instead of o2.

wysota
3rd November 2009, 09:11
Don't you mean -O and -O2? -O2 will automatically be added if you compile in release mode. "-o" is for specifying the output file.

learning_qt
4th November 2009, 07:49
Thanks!

Yes, I mean -O2. In debug mode, how can we add this optimization flag from .pro file?

squidge
4th November 2009, 08:15
I'm a bit confused as to why you would want to. Normally you want to debug your code whilst in debug mode, so you want the least amount of optimisation possible. Only when your code works would you want to increase optimisation to increase speed.

Adding -O2 to debug build will cause all sorts of problem for debugging. Are you sure sure this is what you want?