   Warnings in Standard Includes
  Hi there, happy New Year!I've a question: is there any way to globally disable warnings on standard includes (and I would very much like to avoid using #pragma warning)? This is in Visual C++ 2005 (Express).I've looked through the documentation, google, and the forums, so either I suck at research, or there wasn't anything.For instance, mmsystem.h will cause C4201: nonstandard extension used : nameless struct/union. I don't particularly want to know what the Microsoft supplied headers are doing "wrong".Thanks in advance.jfl.   
Quote:Original post by jflangloisHi there, happy New Year!I've a question: is there any way to globally disable warnings on standard includes (and I would very much like to avoid using #pragma warning)? This is in Visual C++ 2005 (Express).I've looked through the documentation, google, and the forums, so either I suck at research, or there wasn't anything.For instance, mmsystem.h will cause C4201: nonstandard extension used : nameless struct/union. I don't particularly want to know what the Microsoft supplied headers are doing "wrong".Thanks in advance.jfl.The best way I've found is to create a local "warningfree_mmsystem.h" that looks like this:  #pragma warning(push, 3)  #pragma warning(disable: 4201)  #include   #pragma warning(pop)Then include "warningfree_mmsystem.h" instead of  in your code.   ;Quote:Original post by Anonymous PosterThe best way I've found is to create a local "warningfree_mmsystem.h" that looks like this:  #pragma warning(push, 3)  #pragma warning(disable: 4201)  #include   #pragma warning(pop)Then include "warningfree_mmsystem.h" instead of  in your code.Mnyeah. As I said in my original post, I would rather avoid using #pragma warning. I may end up using a variation on this, or I might just try and tolerate the extra warnings if another solution is not found.Thanks for the suggestion though.jfl.   ;  Well technically, mmsystem.h is not a 'standard' include. Also, i'm using VC8 and I don't get that warning from including mmsystem.h. Do you have the latest Platform SDK?   ;  In the compiler options for the C++ compiler, there should be a "ignore specific warnings" option, where you can add the number 4201 (without the C). That should shut up that particular warning.   ;Quote:Original post by RDragon1Well technically, mmsystem.h is not a 'standard' include. Also, i'm using VC8 and I don't get that warning from including mmsystem.h. Do you have the latest Platform SDK?Yeah, I know. I meant library includes that are not directly part of a project or that I don't want to "debug". I do have the latest PSDK, and you are not seeing this warning probably because you did not specify Warning Level 4.Quote:Original post by hplus0603In the compiler options for the C++ compiler, there should be a "ignore specific warnings" option, where you can add the number 4201 (without the C). That should shut up that particular warning.Well, this is not exactly what I'm looking for. I would rather a way to ignore *all* warnings on specific files or folders that I have no interest in (possibly through a compiler option, and not through preprocessor directives or other code modifications). I may want to see warnings in my files, but not in certain library include files.jfl.[Edited by - jflanglois on January 8, 2006 1:27:39 PM];  Actually, most windows api functions that are declared in mmsystem.h have this line in their documentation:Header: Declared in Mmsystem.h; include Windows.h.This means, while the function is declared in mmsystem.h, you should actually include windows.h.   ;Quote:Original post by RDragon1Actually, most windows api functions that are declared in mmsystem.h have this line in their documentation:Header: Declared in Mmsystem.h; include Windows.h.This means, while the function is declared in mmsystem.h, you should actually include windows.h.Which I did. The warning, however, is caused by code in mmsystem.h.I'm starting to think that the functionality that I am looking for does not exist in VC8.   ;  I find it extremely annoying that Microsoft's header files generate warnings (at level 4). I even get them in the standard library header files. I turn off the warnings in my PCH (wrapping all the headers with "#pragma warning( push, 3 )" and "#pragma warning( pop )"). Unfortunately, I still get warnings (which I can't seem to turn off) in the whole program optimization step.c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atltrace.h(188) : warning C4512: 'ATL::CTraceFileAndLineInfo' : assignment operator could not be generatedc:\program files\microsoft visual studio .net 2003\vc7\include\vector(856) : warning C4702: unreachable code;  There's nothing stopping you from modifying your standard library header files and disabling the warnings directly within them.  Push the warning state and disable the warnings you don't want at the top of the file and then pop the state at the bottom.  Shouldn't adversely affect anything.   