在需要之前,必须从模块“Darwin.POSIX.sys.types”中导入“u_char”声明

我在我的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 *} } } 

现在我得到这个错误:

在需要之前,必须从模块“Darwin.POSIX.sys.types”中导入“u_char”声明

我试图在类代码中添加“导入达尔文”,但这不能解决问题。

我解决了这个问题,

模块“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 * } }