blckngm / webview2

Rust bindings for WebView2
MIT License
73 stars 12 forks source link

Build failure after adding webview2 crate #7

Closed waf closed 4 years ago

waf commented 4 years ago

Thanks for making this crate, it's really nice.

When I initially installed it in my application, it broke the build. I can fix it by adding a dev-dependency to my application, but is there a way to avoid this?

Cargo.toml:

[package]
name = "my-app"
version = "0.1.0"
authors = ["waf"]
edition = "2018"

[dependencies]
webview2 = "0.1.0-alpha.6"

Build error:

C:\Projects\my-app› cargo build
   Compiling webview2 v0.1.0-alpha.6
error[E0432]: unresolved import `winapi::shared::winerror`
  --> ~\.cargo\registry\src\github.com-1ecc6299db9ec823\webview2-0.1.0-alpha.6\src\lib.rs:47:21
   |
47 | use winapi::shared::winerror::{
   |                     ^^^^^^^^ could not find `winerror` in `shared`

error: aborting due to previous error

I can build my application again after adding the following dev-dependency to my-app:

[dev-dependencies]
winit = "0.20.0"

If this is hard to fix, I think adding a note to the readme is fine!

blckngm commented 4 years ago

It's because the winerror feature of winapi is missing in our dependencies. Should be easy to fix.

To workaround the problem, you don't need winit as a dev-dependency, just add winapi with the winerror feature as a dependency:


[dependencies]
winapi = { version = "0.3.8", features = ["winerror"] }
blckngm commented 4 years ago

https://github.com/rust-lang/cargo/issues/1796

blckngm commented 4 years ago

Fixed in 0.1.0-alpha.7.

waf commented 4 years ago

Wow, fast turnaround! I can confirm that updating to 0.1.0-alpha.7 resolves the issue. Thanks!