tauri-apps / global-hotkey

Global hotkeys for Desktop Applications.
Apache License 2.0
143 stars 17 forks source link

Unable to Add to Tauri Project #49

Closed mlzxgzy closed 10 months ago

mlzxgzy commented 10 months ago

I initiated a tauri project using create-tauri and wanted to integrate the global-hotkey library to listen for hotkeys. However, after including the global-hotkey library, without making any changes to the code, running cargo tauri dev results in errors. The error messages are as follows:

error[E0432]: unresolved import `self::platform`
  --> C:\Users\aa\.cargo\registry\src\mirrors.sjtug.sjtu.edu.cn-be2141875385cea5\global-hotkey-0.4.1\src\platform_impl\mod.rs:15:22
   |
15 | pub(crate) use self::platform::*;
   |                      ^^^^^^^^ could not find `platform` in `self`

error[E0433]: failed to resolve: could not find `GlobalHotKeyManager` in `platform_impl`
   --> C:\Users\aa\.cargo\registry\src\mirrors.sjtug.sjtu.edu.cn-be2141875385cea5\global-hotkey-0.4.1\src\lib.rs:140:43
    |
140 |             platform_impl: platform_impl::GlobalHotKeyManager::new()?,
    |                                           ^^^^^^^^^^^^^^^^^^^ could not find `GlobalHotKeyManager` in `platform_impl`

error[E0412]: cannot find type `GlobalHotKeyManager` in module `platform_impl`
   --> C:\Users\aa\.cargo\registry\src\mirrors.sjtug.sjtu.edu.cn-be2141875385cea5\global-hotkey-0.4.1\src\lib.rs:134:35
    |
134 |     platform_impl: platform_impl::GlobalHotKeyManager,
    |                                   ^^^^^^^^^^^^^^^^^^^ not found in `platform_impl`

I'm looking for assistance to resolve these errors. Thank you in advance for your help!

mlzxgzy commented 10 months ago

OS: Windows 11, version 10.0.22621 Build 22621