1

I am starting a new addon for MSFS2020 in rust with the SimConnect SDK written in c++. I am using the bingen crates to create the binding with the SDK.

I need to include Windows.h for the binding to work but I get the following error:

error: header 'Windows.h' does not exist.

If I create a simple c++ project on Visual Studio I can successfully include this header so it's definitely there, but I did not succeed to add it in my rust build.

How can I make my rust build find this header and successfully bind the sdk?

Notes:

  1. I installed the c++ toolchain with Visual Studio 2022
  2. I installed the LLVM toolchain and added the LIBCLANG_PATH to the LLVM bin folder in my environment variables
P.E. Joëssel
  • 1,393
  • 10
  • 18
  • Looking into it... For now I'm back with the error that pushed into adding the "windows.h": error: unknown type name 'DWORD'. Any idea for this error? – P.E. Joëssel Feb 19 '22 at 12:24
  • I found a repo that uses this method: https://github.com/rylev/msfs2020 and seems to be workign.. – P.E. Joëssel Feb 19 '22 at 12:28
  • No problem, I contacted the author of the repo but I haven't add any answer yet. I'm sure the solution is dumb as hell but my knowledge in c++ build tools is limited. – P.E. Joëssel Feb 19 '22 at 12:37

1 Answers1

1

The issue comes from access right rules. Running cargo build as an administrator worked perfectly.

P.E. Joëssel
  • 1,393
  • 10
  • 18