-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] error C2338: C++/WinRT external catch clause already defined outside of WIL #1114
Comments
I reopen this because I still have the problem, not sure what happen. |
I don't have the issue with v0.20.1, but only with 1.0.0-rc.2. |
Ok I found a "solution" by editing the file
After that, seems to work... |
I have the same problems when using |
I have the same issue on 1.0.1. I think it related with Windows SDK enviroment because on the one PC it builds correctrly but on the another I have this error. And SDK versions maybe different. I check versions later and write it |
Build ok with [√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19043.1526], locale ru-RU) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6) [!] Android Studio (not installed) [√] VS Code (version 1.70.0) [√] Connected device (1 available) [√] HTTP Host Availability ! Doctor found issues in 1 category. Build error with [√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19043.1826], locale ru-RU) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.11.17) [√] Android Studio (version 2021.2) [√] VS Code, 64-bit edition (version 1.70.0) [√] Connected device (4 available) [√] HTTP Host Availability • No issues found! |
Update: |
@poka-IT can I close this? Seems like it's dependent on the Windows SDK? |
Yes, thank you |
I have this issue too. D:\devspace\flutterspace\todoline>flutter doctor
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.5, on Active code page: 65001
Microsoft Windows [Version 10.0.17134.1304], locale zh-CN) C
hecking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1)
[√] Android Studio (version 2020.3)
[√] Connected device (2 available)
[√] HTTP Host Availability
• No issues found! I've tried to update win 10 SDK, but I failed, I even update Visiual Studio to 2022, but it didn't work. Nuget.exe not found, trying to download or use cached version. After that, I try to download Nuget.exe manually from following URL: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe I found that I couldn't download, I think it's the point: Active code page: 65001
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on Windows in debug mode...
Building Windows application...
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(82,75): error C2338: static_assert failed: 'Please include wil/cppwinrt.h before including any C++/WinRT headers' [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(101,75): error C2338: static_assert failed: 'C++/WinRT external catch clause already defined outside of WIL' [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,103): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,111): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,144): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,152): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(234,85): error C2065: "result": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,39): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2065: "hresult": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2146: ????: ??")"(????"hr"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2143: ????: ??";"(?"{"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2447: "{": ??????(??????????) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(82,75): error C2338: static_assert failed: 'Please include wil/cppwinrt.h before including any C++/WinRT headers' [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(101,75): error C2338: static_assert failed: 'C++/WinRT external catch clause already defined outside of WIL' [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,103): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,111): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,144): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,152): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(234,85): error C2065: "result": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,39): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2065: "hresult": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2146: ????: ??")"(????"hr"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2143: ????: ??";"(?"{"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2447: "{": ??????(??????????) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,103): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,111): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,144): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,152): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(234,85): error C2065: "result": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,39): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2065: "hresult": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2146: ????: ??")"(????"hr"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2143: ????: ??";"(?"{"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2447: "{": ??????(??????????) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,103): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(111,111): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,144): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(231,152): error C2061: ????: ???"hresult" [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(234,85): error C2065: "result": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,39): error C2039: "hresult": ?? "winrt" ??? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2065: "hresult": ??????? [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(270,47): error C2146: ????: ??")"(????"hr"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2143: ????: ??";"(?"{"???) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
D:\devspace\flutterspace\todoline\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5): error C2447: "{": ??????(??????????) [D:\devspace\flutterspace\todoline\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
Exception: Build process failed. |
@todoline-plus-plus please see #1319 |
It build failed, it cannot continue to debug the code. |
@todoline-plus-plus just asking the same questions: Did you install Visual Studio or Visual Studio Build Tools 2022? |
here is the picture: It means that there no items:
See error code above: Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5) I think it lost C++/WinRT, then cause the error. |
After follwing steps, it worked:
C:\Windows\System32>flutter doctor
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.5, on Active code page: 65001
Microsoft Windows [Version 10.0.17134.1304], locale zh-CN) Checking Java status is taking a long time...[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2020.3)
[√] Connected device (2 available)
[√] HTTP Host Availability
! Doctor found issues in 1 category.
|
I can't build the exemple on windows. I tried to clean, pub get, delete windows folder and let vscode rebuild it, still same issue:
The text was updated successfully, but these errors were encountered: