简体   繁体   中英

Qt compiler flags order

My goal is to get rid of some types of compiler warnings. I found out that I can do that by adding compiler flags in my .pro file:

QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-reorder

The problem is that they are added before flags that are generated by Qt build system. I've examined my compiler output:

g++-4.2 -c -pipe -Wno-unused-variable -Wno-reorder -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB

So as you can see -Wall goes after my flags and discards them. What should I do to add those flags after ?

不要使用QMAKE_CXXFLAGS ,而是使用您自己的警告覆盖QMAKE_CXXFLAGS_WARN_ON

QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-variable -Wno-reorder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM