简体   繁体   English

如何将C ++静态库与依赖于标准库的XCode链接?

[英]How to link a C++ static library with XCode which is dependent on standard library?

I have cross compiled the exiv2 library for iOS SDK 6.0. 我已经交叉编译了iOS SDK 6.0的exiv2库。

I confirmed using lipo -i that indeed i386(simulator) and arm7 code is present in the library. 我使用lipo -i确认该库中确实存在i386(simulator)和arm7代码。

The header files (.hpp) of exiv2 uses std. exiv2的头文件(.hpp)使用std。 XCode is unable to find the C++ standard library. XCode无法找到C ++标准库。

Here is my setup: 这是我的设置:

I have one XCode project which targets iOS SDK 6.0. 我有一个针对iOS SDK 6.0的XCode项目。

Inside it, there is a folder called exiv2 and it contains a header and lib folder. 在其中,有一个名为exiv2的文件夹,其中包含一个标头和lib文件夹。 The exiv2 header and the .a library are in those folders. exiv2标头和.a库位于这些文件夹中。

When I compile, I get an error that in (one given file) 编译时,我得到一个错误(在一个给定的文件中)

#include <string> : no such file or directory #include <string> :没有这样的文件或目录

Any ideas on how to link the C++ std under such a setup in XCode? 关于如何在XCode的这种设置下链接C ++ std的任何想法?

Thanks a lot. 非常感谢。

You can go to Project Setting, select "Build Phases" and then "Link Binary with Libraries". 您可以转到项目设置,选择“构建阶段”,然后选择“将二进制文件与库链接”。 For standard C++ library, you can add (+) either "libc++.tbd" or "libstdc++.tbd" 对于标准C ++库,您可以添加(+)“ libc ++。tbd”或“ libstdc ++。tbd”

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

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