简体   繁体   English

在xcode项目中使用.a文件找不到swift erorr'map'文件

[英]in xcode project using .a files with swift erorr 'map' file not found

I'm trying to add an SDK to my Xcode project. 我正在尝试将SDK添加到我的Xcode项目中。 The SDK contains .a files and (headers) .h files. SDK包含.a文件和(标题).h文件。 The headers are imported to my Bridging-Header file (successfully). 标头将导入我的Bridging-Header文件(已成功)。

In the headers there is an #include <map> 在标题中有一个#include <map>

When I run the project I get an 当我运行项目时,我得到了一个

Erorr 'map' file not found 找不到Erorr'map'文件

When I cmd+click on it Xcode take me to The LLVM Compiler Infrastructure . 当我cmd +点击它Xcode带我到LLVM编译器基础设施

What is going wrong here? 这里出了什么问题?

I'm using Xcode Version 7.2 (7C68) with Swift 2.0. 我正在使用Xcode Version 7.2(7C68)和Swift 2.0。

Perhaps you're including C++ files? 也许你包括C ++文件? If so you should add a .mm extension to your implementation instead of .m. 如果是这样,您应该为您的实现添加.mm扩展名而不是.m。

Since you're using Swift you probably need to wrap the component in a Objective-C++ wrapper before you can use it in your project. 由于您使用的是Swift,因此您可能需要先将组件包装在Objective-C ++包装器中,然后才能在项目中使用它。

I had a exact same problem. 我有一个完全相同的问题。 However, I solved this problem by removing #include from Bridging-Header file. 但是,我通过从Bridging-Header文件中删除#include来解决了这个问题。
I'm not an expert on C language family, but according to this answer , the header file seems to be already included before you include it on Bridging-Header file. 我不是C语言系列的专家,但根据这个答案 ,在将其包含在Bridging-Header文件之前,似乎已经包含了头文件。 In fact, Bridging-Header is only bridging Swift-Objective C, it's not relevant to Objective-C compile layer. 实际上,Bridging-Header只是桥接 Swift-Objective C,它与Objective-C编译层无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM