Search code examples
windowsclangwebassembly

Why do I get a 'stddef.h file not found' error when using Clang to target WebAssembly on Windows?


I get the error fatal error: 'stddef.h' file not found when I use clang -target wasm32 -c ./file.c.

Clang works fine when I just do clang -c ./file.c. I am on windows and I believe that is the real root of my troubles. I tried installing universal CRT as suggested here but no luck. I also tried this but I was not able to figure out how to get wasi-sdk to work. If that is the correct path to go down I would appreciate some guidance.


Solution

  • As well a clang, you will also need sysroot of some kind. These are normally provided by either wasi-sdk or emscripten. You should probably install and use of those.