#####詳細
swiftのプログラムをXcodeおよびPlayGroundを使わないでコンパイル及び実行したいです。
HelloWorldのような簡単なプログラムならコンパイル、実行できますが。
僕が作りたいのはSocket通信を行うプログラムです。
以下に簡単ではありますが、そのプログラムをのせました。
###プログラム
swift
1import Foundation 2 3class Socket { 4 //public Thing 5 let adderss:String 6 let port:Int 7 let mess:String 8 let mess_UTF8:[UInt8] 9 var inp:InputStream? 10 var oup:OutputStream? 11 var buffer:[UInt8] 12 var readMess:String 13 14 init(address add: String,port port:Int){ 15 self.address = add 16 self.port = port 17 self.mess = "I'm kousei. nice to meet you" 18 self.mess_UTF8 = [UInt8](mess.utf8) 19 self.buffer = [UInt8](repeating:0,count:255) 20 self.readMess = "" 21 } 22 func MyCliant(){ 23 24 Stream.getStreamsToHost(withName: self.address,port: self.port,inpurtStream: &inp,outputStream: &oup) 25 26 if inp != nil && oup != nil{ 27 let input : InputStream = inp! 28 let output : OutputStream = oup! 29 input.open() 30 output.open() 31 32 if input.streamErro == nil && output.streamErro { 33 while true{ 34 UnsafePointer<UInt8>(mess_UTF8) 35 output.write(mess_UTF8,maxLength:mess_UTF8.count) 36 var readChars:Int = input.read(&buffer,maxLength:buffer.count) 37 if readChars > 0{ 38 readMess = String(cString:readChars) 39 print(">>(readMess)") 40 usleep(400*1000) 41 }else{ 42 println("erro1") 43 input.close() 44 output.close() 45 break 46 } 47 } 48 }else{ 49 println("erro2") 50 } 51 }else{ 52 println("erro3") 53 } 54 } 55}
このプログラムをMacのターミナルでコンパイルすると以下のエラーが出てきてしまいます。
###エラー
socket.swift:14:30: warning: extraneous duplicate parameter name; 'port' already has an argument label init(address add: String,port port:Int){ ^~~~~ <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/CoreFoundation.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: #include <CoreFoundation/CFBase.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: #include <CoreFoundation/CFBase.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum' lzma_reserved_enum reserved_enum3; ^ <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/CoreFoundation.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: #include <CoreFoundation/CFBase.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum' lzma_reserved_enum reserved_enum4; ^ <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/CoreFoundation.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: #include <CoreFoundation/CFBase.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool' lzma_bool ignore_check; ^ <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/CoreFoundation.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: #include <CoreFoundation/CFBase.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool' lzma_bool reserved_bool2; ^ <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/CoreFoundation.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: #include <CoreFoundation/CFBase.h> ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: #include <Block.h> ^ /usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool' lzma_bool reserved_bool3; ^ <unknown>:0: error: too many errors emitted, stopping now <unknown>:0: error: could not build Objective-C module 'CoreFoundation'
###聞きたいこと
このエラーはパーケージのincludeについて詳細を言っているようです。
でも、どうすればいいか分かりません。
どのようにすればこのエラーは消えるのでしょうか。
あなたの回答
tips
プレビュー