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

Created on 27 Apr 2020  路  2Comments  路  Source: tensorflow/swift

I'm using Windows 10 2004. I have downloaded everything for Visual Studio 2019. I already had Visual Studio 2017 but since 2019 was recommended so I went with downloading it separately

I installed CMake 3.17.1 on Windows & it worked. Checked Command-Line after that

I then followed the steps of copy-pasting

set SDKROOT=%SystemDrive%\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
copy "%SDKROOT%\usr\share\ucrt.modulemap" "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap"
copy "%SDKROOT%\usr\share\visualc.modulemap" "%VCToolsInstallDir%\include\module.modulemap"
copy "%SDKROOT%\usr\share\visualc.apinotes" "%VCToolsInstallDir%\include\visualc.apinotes"
copy "%SDKROOT%\usr\share\winsdk.modulemap" "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap"

everything in 2019 cmd visual studio tools....whatever mentioned using admin permissions but I get this error when I compiled my swift code

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

Can anyone suggest to me what went wrong?

Most helpful comment

compiling works like this

set SDKROOT=%SystemDrive%/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk
swiftc -sdk %SDKROOT% -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows -emit-executable test.swift -o test.exe

All 2 comments

compiling works like this

set SDKROOT=%SystemDrive%/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk
swiftc -sdk %SDKROOT% -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows -emit-executable test.swift -o test.exe

Thanks for sharing your solution, I had the same problem!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frogcjn picture frogcjn  路  3Comments

wangtz picture wangtz  路  5Comments

rickwierenga picture rickwierenga  路  3Comments

porterchild picture porterchild  路  4Comments

johndpope picture johndpope  路  6Comments