:0: error: could not load the swift standard library"-6ren"> :0: error: could not load the swift standard library"-在 cygwin 命令行上运行指令“swift hello.swift”后,我收到以下错误消息: :0: 错误: 无法加载 swift 标准库 指令“swift run hello.swift”也出现-6ren">
gpt4 book ai didi

swift - 我在 cygwin 上得到 ":0: error: could not load the swift standard library"

转载 作者:行者123 更新时间:2023-12-05 07:20:31 44 4
gpt4 key购买 nike

在 cygwin 命令行上运行指令“swift hello.swift”后,我收到以下错误消息:

:0: 错误: 无法加载 swift 标准库

指令“swift run hello.swift”也出现了以下错误:

PATH_TO_CYGWIN_HOME/usr/bin/swift-run:加载共享库时出错:?:无法打开共享对象文件:没有这样的文件或目录

我也从 Windows 命令行测试过,我得到了同样的错误。我的机器装有 Windows 10 专业版。

我只是想让自己熟悉 Swift,所以我按照以下链接中的说明为 cygwin 安装了 swift 编译器:https://swiftforwindows.github.io/news/2018/02/12/Swift-for-Windows-Cygwin-20180212/

hello.swift 包含以下代码:

import Swift

print("Hello World");

是否缺少需要安装的库,或者我运行的swift代码不正确?或者我应该向 %PATH% 变量添加一个文件夹(我添加了我认为必要的每个文件夹)。

谢谢

最佳答案

必须先设置SDKROOT。试试这些对我有用的命令。

swiftc -o $fileNameWithoutExt.exe $fileName -sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows && $fileNameWithoutExt.exe

关于swift - 我在 cygwin 上得到 "<unknown>:0: error: could not load the swift standard library",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57474922/

44 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com