CMake can't load the standard library for Swift on Windows

I've tried installing Swift using @compnerd's nightly builds and it installed fine, but when trying to build the examples in https://github.com/compnerd/swift-build-examples/, I receive the following:

<unknown>:0: error: unable to load standard library for target 'x86_64-unknown-windows-msvc'

I tried using the prebuilt installer provided, and I get the same error.

I haven't managed to find anything elsewhere on this, so I posted here.

You should have a look at the documentation at https://github.com/compnerd/swift-build/blob/master/docs/Windows.md for details on the flags that are required (-sdk ...).

The -sdk flags tell the compiler where the platform SDK. The setup on the Windows builds are different so that it is easy to use the toolchain to cross-compile for Android, Windows, and Linux using that toolchain.

So it turns out doing this at one in the morning isn't the best idea.

I forgot to set the variables listed in the documentation. I didn't execute these lines:

SET INSTALLATION_DIR=C:
SET SDK=%INSTALLATION_DIR%\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
SET OS=windows

I ran those before the cmake command and now it works.

Thanks!

Awesome! Glad to hear that you got it working!