2016-08-23 8 views
9

OS:Ubuntuの16.04エラー:未解決の識別子 'プロセス' の使用

スウィフトバージョン:3.0プレビュー6

私はgreeter.swift

func sayHello(name: String) { 
    print("Hello, \(name)!") 
} 

でこのgetting started page

を以下のよ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 

答えて

19

プロセスが迅速3.0

でのCommandLineに変更された受信エラーは、それを変更しているコミットへのリンクです: Rename Process to CommandLine [SE-0086].

+0

CommandLineはGitHuのプロジェクトですSwiftコアライブラリの一部ではありません。 https://github.com/jatoben/CommandLine –

+0

これは機能しました。ありがとうございました。 – ECMAScript

+5

@ChristianAbella: 'CommandLine'はコアSwift 3の一部です:https://github.com/apple/swift/blob/master/stdlib/public/core/CommandLine.swift。 https://github.com/jatoben/CommandLine/issues/77も参照してください。 –

関連する問題