localcc / hid_listener

Keyboard/Mouse event listener library for flutter
MIT License
9 stars 6 forks source link

Compilation will fail on Windows platform #10

Closed 6ag closed 7 months ago

6ag commented 8 months ago
➜  ~ flutter doctor
PS C:\Users\zjf> 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.13.8, on Microsoft Windows [版本 10.0.22621.2428], locale zh-CN)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.29)
[✓] Android Studio (version 2022.1)
[✓] Connected device (3 available)
dart_api_dl.obj : error LNK2005: Dart_PostCObject_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_PostInteger_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_NewNativePort_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_CloseNativePort_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_IsError_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_IsApiError_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_IsUnhandledExceptionError_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_IsCompilationError_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_IsFatalError_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_GetError_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� [D:\Code\Android\hhmzpc\build\windows\plugins\hid_listener\hid_listener_plugin.vcxproj]
dart_api_dl.obj : error LNK2005: Dart_ErrorHasException_DL �Ѿ��� hid_listener_plugin_windows.obj �ж��� 
...
6ag commented 8 months ago

I commented out the .c source file introduced in hid_listener_plugin_windows.cpp, and the IDE will not report an error.

// #include <dart-sdk/include/dart_api_dl.c>
6ag commented 7 months ago

经过测试发现,在 Visual Studio 2019 需要注释 #include <dart-sdk/include/dart_api_dl.c>,而 Visual Studio 2022 不注释也可以正常编译。