Incompatibility between WebView2EnvironmentOptions.h and Qt 6 includes #5317
              
                Unanswered
              
          
                  
                    
                      bassengejp
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Affected versions:
WebView2 SDK version 3179.45 and following
Context:
I am developing a WebView2 based C++ application built with VS2022 that also uses Qt 6 as dependency. For integration of the WebView2 dependencies, I am using the provided WebView2 SDK files included in the nuget package by unzipping the package and directly referencing the depencies in our custom CI build chain, i.e. I do not manually add the nuget package to VS2022.
Problem:
Since update of the WebView2 SDK to 3179.45, the preprocessor macro
in WebView2EnvironmentOptions.h causes the project to fail with build error
C2059: syntax error: '('on the__attribute__statement.The root cause appears to be that
__has_attributeis defined by qcompilerdetection.h for the Qt 6 library. In conclusion, WebView2 and Qt 6 do not seem to be straight away compatible for including the header files in the same source code files.Questions:
__has_attributeshould have been configured somewhere when including the WebView2 SDK?__attribute__statement be compiling, or is the syntax error to be expected?__attribute__((annotate("raw_ptr_exclusion")))section in future WebView2 SDK releases?Possible workarounds:
__attribute__((annotate("raw_ptr_exclusion")))section.#undef __has_attributebefore including WebView2EnvironmentOptions.hBeta Was this translation helpful? Give feedback.
All reactions