必须先从模块"Darwin.POSIX.sys.types"导入"u_char"声明 [英] Declaration of 'u_char' must be imported from module 'Darwin.POSIX.sys.types' before it is required

查看:564
本文介绍了必须先从模块"Darwin.POSIX.sys.types"导入"u_char"声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I imported "if_dl.h" in my Swift framework to use sockaddr_dl like this :

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'

Declaration of 'u_char' must be imported from module 'Darwin.POSIX.sys.types' before it is required

我试图在类代码中添加"import Darwin",但这不能解决问题.

I tried to add "import Darwin" in the class code but it's not resolving the problem.

推荐答案

我解决了这个问题,

模块类型"必须在模块"net"内部,并且必须在添加"if_dl"之前添加

Module "types" have to be inside the module "net" and it have to be added before adding "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 *
     }

 }

这篇关于必须先从模块"Darwin.POSIX.sys.types"导入"u_char"声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆