将Swift代码编译为适用于Linux的本地可执行文件 [英] Compile Swift code to native executable for Linux

查看:173
本文介绍了将Swift代码编译为适用于Linux的本地可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为Linux(Ubuntu)安装了Swift lang,并且运行正常.例如:

I've installed Swift lang for Linux (Ubuntu) and it works fine. For example:

print("Hello World")

要运行它:

./swift hi.swift

我的问题是,是否可以为其生成本机可执行代码?怎么样?

My question is, is it possible to generate a native executable code for it? How?

推荐答案

在Swift目录中列出可执行文件,它具有swiftc.它通过命令生成本地可执行二进制文件:

Listing the executable files in the Swift directory, it has swiftc. It generates a native executable binary by command:

swiftc hi.swift -o hi
./hi

这篇关于将Swift代码编译为适用于Linux的本地可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆