【问题标题】:Declaration of 'u_char' must be imported from module 'Darwin.POSIX.sys.types' before it is required必须先从模块“Darwin.POSIX.sys.types”导入“u_char”声明
【发布时间】:2016-12-26 10:48:28
【问题描述】:

我在我的 Swift 框架中导入了“if_dl.h”,以便像这样使用 sockaddr_dl:

module net [system]  [extern_c] {

     module if_dl {
         umbrella header
         "/Applications/Xcode_7.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/net/if_dl.h"
         module * {export *}
     }

 }

现在我收到了这个错误:

'u_char' 的声明必须从模块中导入 'Darwin.POSIX.sys.types' 之前是必需的

我尝试在类代码中添加“import Darwin”,但没有解决问题。

【问题讨论】:

    标签: ios swift frameworks


    【解决方案1】:

    我解决了这个问题,

    模块“types”必须在模块“net”内,并且必须在添加“if_dl”之前添加

     module net [system]  [extern_c] {
    
         module types {
             header "/usr/include/sys/types.h"
             export *
         }
    
         module if_dl {
    
             header
             "/usr/include/net/if_dl.h"
             export *
         }
    
     }
    

    【讨论】:

      猜你喜欢
      • 2018-07-08
      • 2016-04-23
      • 2022-09-26
      • 2019-12-05
      • 2023-02-15
      • 2014-07-10
      • 2021-11-04
      • 2013-12-04
      • 1970-01-01
      相关资源
      最近更新 更多