[SOLVED] qmake: how to set W4 warning level for MSVC? QMAKE_CFLAGS_WARN_ON has no effect
-
I've tried solution from this topic, and it doesn't work: https://qt-project.org/forums/viewthread/10527/
I use Qt 4. /W4 doesn't even appear in the list of compiler flags, and /W3 isn't going anywhere. -
Hi,
Did you modify QMAKE_CXXFLAGS ?
-
Hi,
I have QMAKE_CXXFLAGS += /MP in a .pro file, if that's what you're asking. -
You can set your flag there.
If it's still not working, you can as a quick last resort modify your mkspec to use W4 rather than 3
-
Oddly enough, I've tried simply doing QMAKE_CXXFLAGS += /MP /W4 (and not touching MAKE_CFLAGS_WARN_ON), and /W4 didn't show up in the visual studio project while /MP did.
-
Depending on the flag order, one might be ignored for the other
-
I expected both /W3 (from QMAKE_CFLAGS_WARN_ON) and /W4 (from my QMAKE_CXXFLAGS) to show up, how is it possible that /W4 got lost? Does qmake perform some analysis of the flags, as opposed to simply putting QMAKE_CXXFLAGS string into the generated project blindly?
-
Did you check the content of the generated Makefiles ?
-
Found the problem. I was using QMAKE_CFLAGS_WARN_ON, while I needed QMAKE_CXXFLAGS_WARN_ON. Silly copy-paste mistake.
-
Then check in visual studio to see if the flag appears or not