I’m coding Qt/C++ in Netbeans 7.0 and i want enable -O3 compiler switch for my project.
The default optimization level of building a project is -O2 in Netbeans.
I added -O3 in this way:
Properties > Build > Qt > Expert > Custom Definitions > Add QMAKE_CXXFLAGS += -O3.
but when rebuilding the project i see this for each .cpp file:
g++.exe -c -O3 -O2 -frtti -fexceptions -mthreads -Wall …… test.cpp
and i think the first -O3 is dropped by second -O2, and the optimization level -O2
how can i configure my project through Properties > Build > .... for -O3? or, how can i remove -O2?
I assume you need
-O3for release build only, right?Then setting
QMAKE_CXXFLAGS_RELEASE += -O3puts-O3ater-O2, at least in my command line build in Debian and MacOS X.That would make sense, since
-O2is provided byQMAKE_CXXFLAGS_RELEASEin platform-specific mkspecs, so appending anything should work like this.