使用 Windows 快速处理 Visual Studio 代码

Nat*_*n E 5 windows macos xcode swift visual-studio-code

我正在使用 Visual Studio 代码在我的 Windows pc 上对 swift 进行编码,我安装了最新的 swift 版本,即swift 5.3, 之后我在名为 Swift 语言的 Visual Studio 代码上下载了 swift 的扩展,我下载了代码运行器,我制作了一个 .swift文件并在我按下运行代码时开始编码,这是显示的错误

C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/SwiftStdint.h:28:10: 错误:'stdint.h' 文件未找到 #include < stdint.h> ^ :0: 错误:无法构建 C 模块“SwiftShims”

小智 0

尝试将这些命令放入终端,它应该可以工作。

set SDKROOT=%SystemDrive%/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk

set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows

swiftc -o example.exe example.swift %SWIFTFLAGS%
Run Code Online (Sandbox Code Playgroud)

注意 - 对于最后一个命令,请将 .swift 和 .exe 之前的示例替换为您的文件名。