Building with Warning level 4
-
Hi, I'm trying to build my C++/CLI project with /W4 today and there's a warning I can't seem to avoid and hope someone here can help. My project has a reference to Microsoft.mshtml for the web browser interfaces. At the first usage in code, I get a slew of warning similar to this:
1>htmlView.cpp(244): warning C4564: method 'open' of interface 'mshtml::DispHTMLDocument' defines unsupported default parameter 'url'
1> This diagnostic occurred while importing type 'mshtml::DispHTMLDocument ' from assembly 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
1> This diagnostic occurred while importing type 'mshtml::HTMLDocumentClass ' from assembly 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.I understand why it's warning (there are optional parameters in the managed interface but the generated C++ interface doesn't have the default values). That's fine.. I'd like to suppress the warning since I can't really do anything about the generated code. I tried the following in various of places in the code including wrapping the whole file with it. Alas, it doesn't prevent the warning.
#pragma warning( push )
#pragma warning( suppress : 4564 ) // /W4 will warn about optional parameters in mshtml interface. . . CLI Code . . .
#pragma warning(pop)
If possible, I'd prefer to suppress it in the source instead of a compile-time switch so I thought I'd ask here... any suggestions? John
-
Hi, I'm trying to build my C++/CLI project with /W4 today and there's a warning I can't seem to avoid and hope someone here can help. My project has a reference to Microsoft.mshtml for the web browser interfaces. At the first usage in code, I get a slew of warning similar to this:
1>htmlView.cpp(244): warning C4564: method 'open' of interface 'mshtml::DispHTMLDocument' defines unsupported default parameter 'url'
1> This diagnostic occurred while importing type 'mshtml::DispHTMLDocument ' from assembly 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
1> This diagnostic occurred while importing type 'mshtml::HTMLDocumentClass ' from assembly 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.I understand why it's warning (there are optional parameters in the managed interface but the generated C++ interface doesn't have the default values). That's fine.. I'd like to suppress the warning since I can't really do anything about the generated code. I tried the following in various of places in the code including wrapping the whole file with it. Alas, it doesn't prevent the warning.
#pragma warning( push )
#pragma warning( suppress : 4564 ) // /W4 will warn about optional parameters in mshtml interface. . . CLI Code . . .
#pragma warning(pop)
If possible, I'd prefer to suppress it in the source instead of a compile-time switch so I thought I'd ask here... any suggestions? John
I gave up and am disabling this warning for the affected file in the vcxproj. Oh well, would have been nice to suppress in source. John