9
OS:Ubuntuの16.04エラー:未解決の識別子 'プロセス' の使用
スウィフトバージョン:3.0プレビュー6
私はgreeter.swift
で
func sayHello(name: String) {
print("Hello, \(name)!")
}
を以下のよmain.swift
if Process.arguments.count != 2 {
print("Usage: hello NAME")
} else {
let name = Process.arguments[1]
SayHello(name: name)
}
私はここでCommandLine
でProcess
を交換してみてください
$ swift build
Compile Swift Module 'myapp' (2 sources)
/Sources/main.swift:1:4: error: use of unresolved identifier 'Process'
if Process.arguments.count != 2 {
^~~~~~~
/Sources/main.swift:4:16: error: use of unresolved identifier 'Process'
let name = Process.arguments[1]
^~~~~~~
<unknown>:0: error: build had 1 command failures
error: exit(1): swift/bin/swift-build-tool -f .build/debug.yaml
CommandLineはGitHuのプロジェクトですSwiftコアライブラリの一部ではありません。 https://github.com/jatoben/CommandLine –
これは機能しました。ありがとうございました。 – ECMAScript
@ChristianAbella: 'CommandLine'はコアSwift 3の一部です:https://github.com/apple/swift/blob/master/stdlib/public/core/CommandLine.swift。 https://github.com/jatoben/CommandLine/issues/77も参照してください。 –