How to cross compile a project with winapi as a dependency (ubuntu to windows)

So I am trying to cross compile a no_std and no_main project that has winapi 0.3.9 as a dependency and I need to import some of the registry keys, but when I put: use winapi::um::winreg::*; and then try to cross compile with cross build --release --target=x86_64-pc-windows-gnu it fails with

error[E0432]: unresolved import `winapi::um::winreg`
 --> src/lib.rs:7:5
  |
7 | use winapi::um::winreg;
  |     ^^^^^^^^^^^^^^^^^^ no `winreg` in `um`

after looking at the docs, it seems that the only targets you can compile to are the msvc ones. is there any way I can either import these or somehow cross compile to x86_64-pc-windows-msvc from ubuntu?

Have you enabled the winreg feature of winapi?

winapi = { version = "0.3.9", features = ["winreg"] }
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.