一千萬個為什麽

搜索

cc1obj:錯誤:類型'({anonymous})'沒有已知的大小,Xcode

是吧?

google什麽都沒有返回此錯誤...我正在做的是將一個movieplayercontroller添加到flipside iphone應用程序中。

cc1obj: error: type '({anonymous})' does not have a known size
{standard input}:228:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_9" minus "L00000000004$pb"
{standard input}:228:symbol: "L_OBJC_SELECTOR_REFERENCES_9" can't be undefined in a subtraction expression
{standard input}:218:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_8" minus "L00000000004$pb"
{standard input}:218:symbol: "L_OBJC_SELECTOR_REFERENCES_8" can't be undefined in a subtraction expression
{standard input}:215:non-relocatable subtraction expression, "L_OBJC_CLASS_REFERENCES_2" minus "L00000000004$pb"
{standard input}:215:symbol: "L_OBJC_CLASS_REFERENCES_2" can't be undefined in a subtraction expression
{standard input}:207:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_7" minus "L00000000004$pb"
{standard input}:207:symbol: "L_OBJC_SELECTOR_REFERENCES_7" can't be undefined in a subtraction expression
{standard input}:203:non-relocatable subtraction expression, "L_OBJC_CLASS_REFERENCES_1" minus "L00000000004$pb"
{standard input}:203:symbol: "L_OBJC_CLASS_REFERENCES_1" can't be undefined in a subtraction expression
{standard input}:151:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_6" minus "L00000000003$pb"
{standard input}:151:symbol: "L_OBJC_SELECTOR_REFERENCES_6" can't be undefined in a subtraction expression
{standard input}:147:non-relocatable subtraction expression, "L_OBJC_CLASS_FlipsideViewController" minus "L00000000003$pb"
{standard input}:147:symbol: "L_OBJC_CLASS_FlipsideViewController" can't be undefined in a subtraction expression
{standard input}:116:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_4" minus "L00000000002$pb"
{standard input}:116:symbol: "L_OBJC_SELECTOR_REFERENCES_4" can't be undefined in a subtraction expression
{standard input}:110:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_5" minus "L00000000002$pb"
{standard input}:110:symbol: "L_OBJC_SELECTOR_REFERENCES_5" can't be undefined in a subtraction expression
{standard input}:80:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_2" minus "L00000000001$pb"
{standard input}:80:symbol: "L_OBJC_SELECTOR_REFERENCES_2" can't be undefined in a subtraction expression
{standard input}:74:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_3" minus "L00000000001$pb"
{standard input}:74:symbol: "L_OBJC_SELECTOR_REFERENCES_3" can't be undefined in a subtraction expression
{standard input}:67:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_1" minus "L00000000001$pb"
{standard input}:67:symbol: "L_OBJC_SELECTOR_REFERENCES_1" can't be undefined in a subtraction expression
{standard input}:64:non-relocatable subtraction expression, "L_OBJC_CLASS_REFERENCES_0" minus "L00000000001$pb"
{standard input}:64:symbol: "L_OBJC_CLASS_REFERENCES_0" can't be undefined in a subtraction expression
{standard input}:58:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_0" minus "L00000000001$pb"
{standard input}:58:symbol: "L_OBJC_SELECTOR_REFERENCES_0" can't be undefined in a subtraction expression
{standard input}:54:non-relocatable subtraction expression, "L_OBJC_CLASS_FlipsideViewController" minus "L00000000001$pb"
{standard input}:54:symbol: "L_OBJC_CLASS_FlipsideViewController" can't be undefined in a subtraction expression
{standard input}:unknown:Undefined local symbol L_OBJC_CLASS_FlipsideViewController
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_0
{standard input}:unknown:Undefined local symbol L_OBJC_CLASS_REFERENCES_0
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_1
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_3
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_2
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_5
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_4
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_6
{standard input}:unknown:Undefined local symbol L_OBJC_CLASS_REFERENCES_1
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_7
{standard input}:unknown:Undefined local symbol L_OBJC_CLASS_REFERENCES_2
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_8
{standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_9

將編譯器轉為clang(llvc)之後

我得到了這個內部編譯器錯誤:分段錯誤

-(IBAction)clickedOpenMovie:(void)sender
{
    NSString *myString = [NSString stringWithFormat:@"http://localhost:1935/mystream/mystream.sdp"];

    NSURL *myURL = [NSURL URLWithString:myString];

   [self playMovieAtURL:myURL];

}

最佳答案

<�預> <�代碼> - (IBAction為)clickedOpenMovie:(無效)發送方 </代碼>

那是錯的。 void 表示沒有類型,並且您不能將無類型的參數傳遞給函數。這可能是你從cc1obj那裏得到的錯誤。

動作方法的正確簽名是:

-(IBAction)clickedOpenMovie:(id)sender

id is the type of anyobjective-cobject.

 NSString * myString = [NSString stringWithFormat:@“http:// localhost:1935/mystream/mystream.sdp”];
</代碼> 

這都是錯誤的,因為那不是格式字符串,而且沒有意義,因為你已經有了完成的字符串。剪切消息並直接將字符串分配給變量:

NSString *myString = @"http://localhost:1935/mystream/mystream.sdp";

當你有一個格式字符串和一些你希望拼接到它的值時,你應該只使用 stringWithFormat:

轉載註明原文: cc1obj:錯誤:類型'({anonymous})'沒有已知的大小,Xcode