ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
32.37k stars 2.36k forks source link

Could improve `zig build-exe main.zig -lc` WindowsSdkNotFound error #6778

Open slimsag opened 3 years ago

slimsag commented 3 years ago

Running zig-windows-x86_64-0.6.0+2ee79f149 and following the C interaction documentation I end up with:

zig run .\main.zig -lc
error: unable to create compilation: WindowsSdkNotFound

It would be great if this could link to e.g. a documentation page or provide more info about which windows SDK I need to install. The Windows 10 SDK and VS2019 both come to mind but it is not immediately clear.

I know this is minor, but could help out newcomers - would a contribution to improve this be welcome?

andrewrk commented 3 years ago

6565 should be a really nice solution to this, because it will make this situation Just Work, without Windows SDK needing to be installed at all.

However this issue is still relevant because it would apply to when someone uses -target native-native-msvc. In that case, yes a contribution to improve this would be welcome, but perhaps do you want to brainstorm what you would like Zig to print instead?

slimsag commented 3 years ago

After #6565 will mingw-w64 be required instead? Or will Zig workaround that somehow? I imagine e.g. the windows headers would still be needed (but not for pure Zig programs)

As for the error in the case of msvc, I imagine we don’t want to direct link a download for the SDK, and presumably we would want to link to the right version for the Windows OS (10, 7, maybe even XP?) so perhaps we could link to a Zig documentation page instead, and have that page describe in a bit more detail what is required - with direct links for Windows 10 and some tips/hints for older versions perhaps.

Has Zig considered emitting static error codes that can be searched and documented in docs more extensively, similar to what Rust does?