Why disable specific warning not working in Visual Studio

来源:互联网 发布:三岛由纪夫 禁色 知乎 编辑:程序博客网 时间:2024/06/04 18:56

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






down voteaccepted

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.


0 0