audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

[Windows] error C2338: C++/WinRT external catch clause already defined outside of WIL

Open poka-IT opened this issue 2 years ago • 7 comments

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:

Launching lib\main.dart on Windows in debug mode...
Nuget.exe not found, trying to download or use cached version.
C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(82,75): error C2338: Please include wil/cppwinrt.h before including any C++/WinRT headers [C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(101,75): error C2338: C++/WinRT external catch clause already defined outside of WIL [C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(82,75): error C2338: Please include wil/cppwinrt.h before including any C++/WinRT headers [C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(101,75): error C2338: C++/WinRT external catch clause already defined outside of WIL [C:\Users\poka\dev\audioplayers\packages\audioplayers\example\build\windows\plugins\audioplayers_windows\audioplayers_windows_plugin.vcxproj]
Exception: Build process failed.
Exited (sigterm)

poka-IT avatar May 02 '22 17:05 poka-IT

I reopen this because I still have the problem, not sure what happen. I had to download nuget.exe et put it in C:\Windows\system32 manually, so I don't have Nuget.exe not found, trying to download or use cached version. warning anymore, but still the rest.

poka-IT avatar May 03 '22 10:05 poka-IT

I don't have the issue with v0.20.1, but only with 1.0.0-rc.2. Still blocked on this, I tried tones of things, I don't understand.

poka-IT avatar May 05 '22 16:05 poka-IT

Ok I found a "solution" by editing the file build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h:

  • Commented line 78 to 84:
// #ifdef CPPWINRT_VERSION
// // Prior to C++/WinRT "2.0" this header needed to be included before 'winrt/base.h' so that our definition of
// // 'WINRT_EXTERNAL_CATCH_CLAUSE' would get picked up in the implementation of 'winrt::to_hresult'. This is no longer
// // problematic, so only emit an error when using a version of C++/WinRT prior to 2.0
// static_assert(::wil::details::major_version_from_string(CPPWINRT_VERSION) >= 2,
//     "Please include wil/cppwinrt.h before including any C++/WinRT headers");
// #endif
  • Commented line 100 to 103:
// #if __WI_CONFLICTING_WINRT_EXTERNAL_CATCH_CLAUSE
// static_assert(::wil::details::major_version_from_string(CPPWINRT_VERSION) >= 2,
//     "C++/WinRT external catch clause already defined outside of WIL");
// #endif 

After that, seems to work...

poka-IT avatar May 05 '22 17:05 poka-IT

Ok I found a "solution" by editing the file build\windows\packages\Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h:

  • Commented line 78 to 84:
// #ifdef CPPWINRT_VERSION
// // Prior to C++/WinRT "2.0" this header needed to be included before 'winrt/base.h' so that our definition of
// // 'WINRT_EXTERNAL_CATCH_CLAUSE' would get picked up in the implementation of 'winrt::to_hresult'. This is no longer
// // problematic, so only emit an error when using a version of C++/WinRT prior to 2.0
// static_assert(::wil::details::major_version_from_string(CPPWINRT_VERSION) >= 2,
//     "Please include wil/cppwinrt.h before including any C++/WinRT headers");
// #endif
  • Commented line 100 to 103:
// #if __WI_CONFLICTING_WINRT_EXTERNAL_CATCH_CLAUSE
// static_assert(::wil::details::major_version_from_string(CPPWINRT_VERSION) >= 2,
//     "C++/WinRT external catch clause already defined outside of WIL");
// #endif 

After that, seems to work...

I have the same problems when using audioplayers: ^1.0.0-rc.4, and I followed the instructions mentioned above, it worked. But it seems like a hack.

liudonghua123 avatar Jun 08 '22 07:06 liudonghua123

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

zappaz00 avatar Aug 08 '22 15:08 zappaz00

Build ok with

[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19043.1526], locale ru-RU) • Flutter version 3.0.5 at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at C:\Users\filin\AppData\Local\Android\sdk • Platform android-33, build-tools 33.0.0 • Java binary at: C:\Program Files\Java\jdk-18.0.1.1\bin\java • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6) • All Android licenses accepted.

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.2.32630.192 • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code (version 1.70.0) • VS Code at C:\Users\filin\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.46.0

[√] Connected device (1 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1526]

[√] HTTP Host Availability • All required HTTP hosts are available

! 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) • Flutter version 3.0.5 at C:\flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at C:\Users\zappaz00\AppData\Local\Android\sdk • Platform android-33, build-tools 33.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.11.17) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional • Visual Studio Professional 2019 version 16.11.32630.194 • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] VS Code, 64-bit edition (version 1.70.0) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.46.0

[√] Connected device (4 available) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1826] • Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.79 • Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.47

[√] HTTP Host Availability • All required HTTP hosts are available

• No issues found!

zappaz00 avatar Aug 08 '22 18:08 zappaz00

Update: I updated Windows SDK from 10.0.18362.0 to 10.0.19041.0 and error disappered.

zappaz00 avatar Aug 08 '22 18:08 zappaz00

@poka-IT can I close this? Seems like it's dependent on the Windows SDK?

Gustl22 avatar Sep 27 '22 17:09 Gustl22

Yes, thank you

poka-IT avatar Sep 27 '22 22:09 poka-IT

I have this issue too. This is flutter doctor message:

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. It always said:

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: I cannot download it directly. I have try to download this file by other methods. After I put it in the folder: /windows/system32/, I got this error:

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 avatar Nov 19 '22 09:11 todoline-plus-plus

@todoline-plus-plus please see #1319 Its only a warning, it should compile anyways.

Gustl22 avatar Nov 19 '22 09:11 Gustl22

@todoline-plus-plus please see #1319 Its only a warning, it should compile anyways.

It build failed, it cannot continue to debug the code. I have compared the screenshot you've shown in [#319 ] (https://github.com/bluefireteam/audioplayers/issues/1319). I found that there are no Individual components in my system to select, what should I do next?

todoline-plus-plus avatar Nov 19 '22 10:11 todoline-plus-plus

@todoline-plus-plus just asking the same questions:

Did you install Visual Studio or Visual Studio Build Tools 2022? Which version of VS or Build Tools do you use? Did you select the Desktop development with C++ and all default components? I upgraded to Win11 SDK 10.0.22621.0. But Win10 SDK 10.0.19041.0 is also working fine.

Gustl22 avatar Nov 19 '22 10:11 Gustl22

here is the picture: https://todoline-plus-plus.github.io/backlink/pic/nuget_exe_not_found.png https://todoline-plus-plus.github.io/backlink/pic/nuget_exe_not_found_1.png https://todoline-plus-plus.github.io/backlink/pic/nuget_exe_not_found_2.png

It means that there no items:

  1. Windows Universal C Runtime
  2. C++/WinRT

See error code above:

Microsoft.Windows.ImplementationLibrary\include\wil/cppwinrt.h(271,5)

I think it lost C++/WinRT, then cause the error.

todoline-plus-plus avatar Nov 19 '22 10:11 todoline-plus-plus

After follwing steps, it worked:

  1. Uninstall Visual Studio Build tools 2017.
  2. Uninstall Visual Studio Build tools 2019.
  3. Run command: flutter doctor, then got the following messages:
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.
  1. Reinstall build tool for Visual studio 2022 Select Desktop development with C++, then checked MSVC v142 - VS 2019 C++ x64/x86 build tools.

todoline-plus-plus avatar Nov 20 '22 02:11 todoline-plus-plus