When the level of warnings to be generated by the compiler is set to 4 (/W4), I'm getting multiple C4201 compiler warnings in the d3d11.h header file when compiling the following code:
#include <windows.h> #include <d3d11.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return 0; }
I know that there are other ways to get rid of the warnings like lowering the warning level or suppressing that particular warning. But it just feels wrong to make these compromises for that single header file I want to include in my code. Especially because this header file was written by Microsoft who they, themselves, recommend to use /W4!
By the way, I've accidentally noticed that when I include the audioclient.h header file above the d3d11.h, all the warnings are gone and the code compiles perfectly fine:
#include <windows.h> #include <audioclient.h> #include <d3d11.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return 0; }
So it seems that audioclient.h contains something in it that eliminates these warnings, I just can't figure out what :(