开发者

What is the best solution for suppressing warning from a MS include (C4201 in mmsystem.h)

开发者 https://www.devze.com 2022-12-11 01:41 出处:网络
I am tired of having to look at warni开发者_运维问答ngs during our compilations - warnings that come from MS include files.

I am tired of having to look at warni开发者_运维问答ngs during our compilations - warnings that come from MS include files.

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\mmsystem.h(1840): warning C4201: nonstandard extension used : nameless struct/union"

I have seen this thread that suggests changing the header itself (but then each of my team mates has to do it and we have to do it on the build server - not to mention it is a glorious HACK)

Is there a better way? I don't want to turn it off globally - just to suppress it for certain files or directories.

Any suggestions?

EDIT For some stupid reason I didn't think I could set warning levels across include files. Thanks - that does the trick.


Something like

#pragma warning(push, disable: 4201)
#include <mmsystem.h>
#pragma warning(pop)


How about using #pragma warning extension in VC++?

http://msdn.microsoft.com/en-us/library/2c8f766e(VS.80).aspx

#pragma warning (push, 2)  // Temporarily setting warning level 2
#include <mmsystem.h>
#pragma warning (pop)      // Restore back

You may also try ..

#pragma warning (disable: 4201)
#include <mmsystem.h>
#pragma warning (default)


With VS 2017 Community, to avoid warning C4083, I use :

#pragma warning(push)
#pragma warning(disable:4201)
#include <dxvahd.h>
#pragma warning(pop) 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号