Why disable specific warning not working in Visual Studio

Vincent picture Vincent · Dec 5, 2013 · Viewed 6.9k times · Source

With Visual Studio C++ 2013, I have a lot of warning C4100: unreferenced formal parameter, and I want to disable that. I added 4100 to the "Disable Specific Warnings" in the project for both Debug|Release configurations but unfortunately VS still output the warnings.

I was using VS2008, and the Disable Specific Warning was working but now with VS2013, it doesn't. What I'm doing wrong?

EDIT:

Compiler command line :

/GS /analyze- /W3 /wd"4100" /Zc:wchar_t /I [...] /Zi /Gm- /Od /Fd".\" /fp:precise /D "_WIN32_WINNT=0x0601" /D "_CRT_SECURE_NO_WARNINGS" /D [...] /errorReport:prompt /WX- /Zc:forScope /GR /Gd /Oy- /MDd /Fa"debug\" /EHsc /nologo /Fo"debug\" /Fp"debug\project1.pch"

Additionnal options:

-Zm200 -w34100 -w34189 /MP

Answer

user1661176 picture user1661176 · May 1, 2014

This was driving me nuts for a while now. My problem was that Qt's default qmake.conf for win32-msvc2013 (look under qtdir\mkspecs) contains the following line: QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189

You didn't say you were using Qt, but the -w34100 parameter sets warning 4100 to be seen at the W3 level instead of the W4 level. This will have precedence over the -wd4100, hence you'll still see the warnings. For those of us using qt you can either add QMAKE_CXXFLAGS_WARN_ON -= -w34100 to your .pro file or remove the argument in the mkspecs folder.