natsuk4ze / gal

How to Save Image or Video to Photo Gallery in Flutter
https://pub.dev/packages/gal
BSD 3-Clause "New" or "Revised" License
85 stars 13 forks source link

Windows platform cannot compile #165

Closed molihuan closed 8 months ago

molihuan commented 8 months ago

Did you check the documentation and it did not help?

Overview

Windows platform cannot compile

Steps to reproduce

Clone this project and compile it on the Windows platform. Compilation error, Android platform can

Code sample

Official example of gal, 2023.11.5 10:27

Environment

Logs ```console [!] Flutter (Channel stable, 3.13.7, on Microsoft Windows [版本 10.0.19043.1586], locale zh-CN) • Flutter version 3.13.7 on channel stable at C:\Users\moli\fvm\default ! Warning: `flutter` on your path resolves to E:\DesktopSpace\Development\Environment\FlutterSDK\cache\3.13.7\bin\flutter, which is not inside your current Flutter SDK checkout at C:\Users\moli\fvm\default. Consider adding C:\Users\moli\fvm\default\bin to the front of your path. ! Warning: `dart` on your path resolves to E:\DesktopSpace\Development\Environment\FlutterSDK\cache\3.13.7\bin\dart, which is not inside your current Flutter SDK checkout at C:\Users\moli\fvm\default. Consider adding C:\Users\moli\fvm\default\bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2f708eb839 (4 weeks ago), 2023-10-09 09:58:08 -0500 • Engine revision a794cf2681 • Dart version 3.1.3 • DevTools version 2.25.0 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at E:\DesktopSpace\Development\Environment\Androidstudio\sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = E:\DesktopSpace\Development\Environment\Androidstudio\sdk • Java binary at: E:\DesktopSpace\Development\Environment\Androidstudio\Androidstudio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Users\moli\AppData\Local\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Professional 2019 16.11.24) • Visual Studio at E:\DesktopSpace\Development\Environment\vs2019\Professional • Visual Studio Professional 2019 version 16.11.33328.57 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2022.3) • Android Studio at E:\DesktopSpace\Development\Environment\Androidstudio\Androidstudio • 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 • android-studio-dir = E:\DesktopSpace\Development\Environment\Androidstudio\Androidstudio • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231) [√] Connected device (6 available) • Redmi Note 8 Pro (mobile) • z5irov956llz69zh • android-arm64 • Android 10 (API 29) • GM1910 (mobile) • 127.0.0.1:5555 • android-x64 • Android 9 (API 28) • GM1910 (mobile) • emulator-5554 • android-x64 • Android 9 (API 28) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19043.1586] • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.105 • Edge (web) • edge • web-javascript • Microsoft Edge 114.0.1823.82 (unsupported) ```

Logs

Logs ```console [ +31 ms] CustomBuild: [ ] Building Custom Rule E:/DesktopSpace/Development/Flutter/gal/example/windows/flutter/ephemeral/.plugin_symlinks/gal/windows/CMakeLists.txt [ +63 ms] ClCompile: [ ] E:\DesktopSpace\Development\Environment\vs2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\CL.exe /c /IE:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral /IE:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral\cpp_client_wrapper\include /Zi /nologo /W4 /WX /diagnostics:column /Od /Ob0 /D WIN32 /D _WINDOWS /D _HAS_EXCEPTIONS=0 /D _DEBUG /D FLUTTER_PLUGIN_IMPL /D UNICODE /D _UNICODE /D "CMAKE_INTDIR=\"Debug\"" /D gal_plugin_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++latest /Fo"gal_plugin.dir\Debug\\" /Fd"gal_plugin.dir\Debug\vc142.pdb" /external:W4 /Gd /TP /wd4100 /errorReport:queue /await E:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral\.plugin_symlinks\gal\windows\gal_plugin_c_api.cpp E:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral\.plugin_symlinks\gal\windows\gal_plugin.cpp [ +42 ms] gal_plugin_c_api.cpp [ +902 ms] gal_plugin.cpp [+1477 ms] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(983,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1004,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1038,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1057,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : �μ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(985): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncAction�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : �μ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1006): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncActionWithProgress�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : �μ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1040): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncOperationWithProgress�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : �μ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1059): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncOperation�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ +933 ms] �������ɴ���... [ +52 ms] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ� [ ] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\runner\example.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ� [ ] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\ALL_BUILD.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ� [ ] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\INSTALL.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ� [ ] ����ʧ�ܡ� [ +2 ms] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\INSTALL.vcxproj��(Ĭ��Ŀ��) (1) -> [ ] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\ALL_BUILD.vcxproj��(Ĭ��Ŀ��) (3) -> [ ] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\runner\example.vcxproj��(Ĭ��Ŀ��) (4) -> [ ] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj��(Ĭ��Ŀ��) (7) -> [ ] (ClCompile Ŀ��) -> [ ] 0 ������ [ ] 4 ������ [ ] ����ʱ�� 00:00:20.36 [{"event":"app.progress","params":{"appId":"c3034c50-4569-4226-85e4-80fbc8503c58","id":"0","progressId":null,"finished":true}}] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(983,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1004,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1038,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1057,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj] [ +12 ms] Exception: Build process failed. [ +2 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:662:9) #2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1297:27) #3 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #4 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:339:9) #6 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:285:5) #8 run.. (package:flutter_tools/runner.dart:115:9) #9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #10 main (package:flutter_tools/executable.dart:90:3) ```
natsuk4ze commented 8 months ago

Thank you for your contribution @molihuan 🤝

Are you saying that you can use the plugin fine, but you can't build the example?

Let's fix the Flutter Doctor warnings and update Visual Studio and see if that fixes it 👀

molihuan commented 8 months ago

Thank you for your contribution @molihuan 🤝

Are you saying that you can use the plugin fine, but you can't build the example?

Let's fix the Flutter Doctor warnings and update Visual Studio and see if that fixes it 👀

It works on Android, but it doesn't work on Windows and cannot be built, even in your official example.👀 I don't know if it's a version issue with Visual Studio. I am using Visual Studio Professional 2019 version 16.11.33328.57.

natsuk4ze commented 8 months ago

Can't use Plugin or can't build example? Which is it? This Plugin requires C++20 on Windows platforms. older versions of Visual Studio may result in compilation errors. You seem to be using 2019, can you update to 2022? Also, I am concerned that Flutter doctor is also giving warnings.

molihuan commented 8 months ago

Can't use Plugin or can't build example? Which is it? This Plugin requires C++20 on Windows platforms. older versions of Visual Studio may result in compilation errors. You seem to be using 2019, can you update to 2022? Also, I am concerned that Flutter doctor is also giving warnings.

Sorry, I didn't see that this plugin requires C++20, my problem

natsuk4ze commented 8 months ago

Sorry, I didn't see that this plugin requires C++20, my problem

np👌 You can see it in readme

molihuan commented 8 months ago

Sorry, I didn't see that this plugin requires C++20, my problem

np👌 You can see it in readme

ha ha ha. Sorry