I could not use swift 5.9 on windows

I added the environment variable SWIFTFLAGS as "-sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows"
but i still could not use seift repl on windows.
PS C:\Users\admin> swift repl -target x86_64-unknown-windows-msvc %SWIFTFLAGS% <unknown>:0: error: error opening input file '%SWIFTFLAGS%' (no such file or directory)

Historically, the Swift REPL hasn’t been ready for use on Windows, but @compnerd has reported significant progress recently. The instructions in this post and a recent snapshot may be of interest:

2 Likes

The instructions assumed that you’re using CMD, not Powershell. If you want to use Powershell instead, you need to change the way of using environment variables.

set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows
$env:SWIFTFLAGS = "-sdk $env:SDKROOT -I $env:SDKROOT/usr/lib/swift -L $env:SDKROOT/usr/lib/swift/windows"
3 Likes