简体   繁体   中英

Qt Creator: Treat warnings as errors

在Visual Studio中,有一个选项可以告诉编译器将警告视为错误,如何使用Qt Creator设置它(我使用VS2008作为编译器)。

I needed to add

QMAKE_CXXFLAGS += /WX

to my .pro file.

For both compilers (VS and MinGW) use:

win32-g++ {
   QMAKE_CXXFLAGS += -Werror
}
win32-msvc*{
   QMAKE_CXXFLAGS += /WX
}

An alternative to adding "QMAKE_CXXFLAGS+=-Werror" to your .pro file is to add it to build configuration via the "Projects" tab.

在qt creator中添加cxxflag

This setting will be stored in .pro.user file.

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