从Swift桥接标题(Linux)导入stdlib.h时出错

时间:2018-08-16 00:07:06

标签: c swift linux

我已使用these instructions在Ubuntu 16.04上安装了Swift 4.1.3。普通的仅限Swift的代码可以完美地工作,但是我需要与一些C库进行接口,因此我包含了一个桥接标头。但是,只要桥接头(或其任何依赖项)包含以下行:

#include <stdlib.h>

编译时出现以下错误:

<unknown>:0: error: module 'SwiftGlibc' in AST file '/tmp/org.llvm.clang.ubuntu/ModuleCache/7NOV3A4XDTWQ/SwiftGlibc-1JWOQWYGL30RZ.pcm' (imported by AST file '/tmp/test-31a824.pch') is not defined in any loaded module map file; maybe you need to load '/home/ubuntu/swift-4.1.3-RELEASE-ubuntu16.04/usr/lib/swift/linux/x86_64/glibc.modulemap'?
<unknown>:0: note: consider adding '/home/ubuntu/swift-4.1.3-RELEASE-ubuntu16.04/usr/lib/swift/linux/x86_64' to the header search path
<unknown>:0: note: imported by '/tmp/test-31a824.pch'
<unknown>:0: error: clang importer creation failed

我尝试按照/home/ubuntu/swift-4.1.3-RELEASE-ubuntu16.04/usr/lib/swift/linux/x86_64到我的$CPATH的说明进行操作,但是我无法解决此错误。任何建议将不胜感激!

0 个答案:

没有答案