【问题标题】:Why won't clang compile my code?为什么不编译我的代码?
【发布时间】:2012-02-17 15:35:13
【问题描述】:

之前,我用gcc,下面编译好了。但是,使用 clang 时,出现以下错误:

MyWindow.mm:37:25: error: cannot initialize a parameter of type 
                          'id<NSTextViewDelegate>' with an lvalue of type 
                          'NSWindow *'
  [textView setDelegate:win];  
                        ^~~

怎么了?

【问题讨论】:

    标签: objective-c gcc migration clang nswindow


    【解决方案1】:

    编译器的意思是NSWindow 没有实现NSTextViewDelegate

    可能你的子类实际上存储在 NSWindow 指针中,在这种情况下你应该尝试;

    [textView setDelegate:(MyRealWindowClass*)win]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-11
      • 2017-01-11
      • 1970-01-01
      相关资源
      最近更新 更多