gpt4 book ai didi

ios - 如何在 IOS 上使用 Boost 和 Cocoapods?

转载 作者:可可西里 更新时间:2023-11-01 02:58:18 26 4
gpt4 key购买 nike

有没有人成功地将 Cocoapods 与 Boost pod 一起使用?

我不明白它似乎没有完全安装。在 pod 安装到一个空白项目后,我得到以下信息。有没有我遗漏的步骤?

enter image description here

这是我安装的结果

pod 安装 --verbose

Analyzing dependencies

Updating spec repositories
$ /Applications/XCode.app/Contents/Developer/usr/bin/git rev-parse >/dev/null 2>&1
$ /Applications/XCode.app/Contents/Developer/usr/bin/git rev-parse >/dev/null 2>&1
Updating spec repo `master`
$ /Applications/XCode.app/Contents/Developer/usr/bin/git pull --ff-only
Already up-to-date.

CocoaPods 0.36.3 is available.
To update use: `gem install cocoapods`

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.


Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods`: (``)
Using `ARCHS` setting to build architectures of target `Pods-PodBoost`: (``)

Resolving dependencies of `Podfile`
Starting resolution (2015-04-01 15:48:56 +0300)
Creating possibility state for boost (~> 1.57) (1 remaining)
Attempting to activate boost (1.57.0)
Activated boost at boost (1.57.0)
Requiring nested dependencies (boost/string_algorithms-includes (= 1.57.0), boost/shared_ptr-includes (= 1.57.0), boost/pointer_cast-includes (= 1.57.0), boost/numeric-includes (= 1.57.0), boost/preprocessor-includes (= 1.57.0), boost/math-includes (= 1.57.0), boost/graph-includes (= 1.57.0))
Creating possibility state for boost/string_algorithms-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/string_algorithms-includes (1.57.0)
Activated boost/string_algorithms-includes at boost/string_algorithms-includes (1.57.0)
Requiring nested dependencies ()
Creating possibility state for boost/shared_ptr-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/shared_ptr-includes (1.57.0)
Activated boost/shared_ptr-includes at boost/shared_ptr-includes (1.57.0)
Requiring nested dependencies ()
Creating possibility state for boost/pointer_cast-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/pointer_cast-includes (1.57.0)
Activated boost/pointer_cast-includes at boost/pointer_cast-includes (1.57.0)
Requiring nested dependencies ()
Creating possibility state for boost/numeric-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/numeric-includes (1.57.0)
Activated boost/numeric-includes at boost/numeric-includes (1.57.0)
Requiring nested dependencies ()
Creating possibility state for boost/preprocessor-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/preprocessor-includes (1.57.0)
Activated boost/preprocessor-includes at boost/preprocessor-includes (1.57.0)
Requiring nested dependencies ()
Creating possibility state for boost/math-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/math-includes (1.57.0)
Activated boost/math-includes at boost/math-includes (1.57.0)
Requiring nested dependencies ()
Creating possibility state for boost/graph-includes (= 1.57.0) (1 remaining)
Attempting to activate boost/graph-includes (1.57.0)
Activated boost/graph-includes at boost/graph-includes (1.57.0)
Requiring nested dependencies ()
Finished resolution (8 steps) (Took 0.007472 seconds) (2015-04-01 15:48:56 +0300)
Unactivated:
Activated: boost, boost/string_algorithms-includes, boost/shared_ptr-includes, boost/pointer_cast-includes, boost/numeric-includes, boost/preprocessor-includes, boost/math-includes, boost/graph-includes

Comparing resolved specification to the sandbox manifest
A boost

Downloading dependencies

-> Installing boost (1.57.0)
> Http download
$ /usr/bin/curl -f -L -o /Users/ryanheitner/Projects/PodBoost/Pods/boost/file.tgz "http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.gz" --create-dirs
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 353 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 423 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 337 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 70.0M 100 70.0M 0 0 2744k 0 0:00:26 0:00:26 --:--:-- 3007k
$ /usr/bin/tar xfz /Users/ryanheitner/Projects/PodBoost/Pods/boost/file.tgz -C /Users/ryanheitner/Projects/PodBoost/Pods/boost
- Running pre install hooks

Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Linking headers
- Installing targets
- Installing target `Pods-PodBoost` iOS 8.2
- Running post install hooks
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`

最佳答案

为什么没有列出 Pod?

这是 boost 的产物,不是 Xcode 项目,只是一组文件。此外,您会发现 boost 内部目录位于 ${PODS_ROOT}/boost 内,在 Build SettingsHeader Search Path 中引用。这就是您使用 Pod 的好处。

Pod 和 Boost 层次结构

需要在 boost 中嵌套 ../Pods/boost/boost 以允许库中的文件引用自身,如下所示:

#include "boost/date_time/posix_time/posix_time_config.hpp"

如果让操作完成:(压缩后 boost 库超过 100 MB)

Downloading dependencies
Installing boost (1.57.0)
Generating Pods project
Integrating client project

...虽然您在项目中看不到它,但您会发现它在源代码树中:

enter image description here

你可以引用它:

#import "boost/date_time.hpp"

并开始处理其他紧迫的问题,例如定位 #include <cstdlib> ,这完全是另一个话题。

Objective-C++ 编译

为了编译 boost ,它是一个 C++ 库,您需要从 C++ 源文件(不是 C源,这是 .m 中的默认值),或采用 compiling a C++ class in Xcode: error during compilation: stl vector 中列出的替代解决方案。

.mm 文件中,包含以下两个测试行:

#include <cstdlib> // Proof of concept
#import "boost/date_time.hpp"

为了这个例子,我将 main.m 重命名为 main.mm 。由于 Pod 没有导入任何 .ipp 文件,您可以在 Build SettingsPreprocessor Macros 中添加 NO_BOOST_DATE_TIME_INLINE=1。这样做,您将收到大约一打警告,如下所示,并且编译成功,无需手动导入。

Implicit conversion loses integer precision: 'long' to 'hour_type' (aka 'int')


编辑:删除了一个偏离主题的手动导入,不需要


关于ios - 如何在 IOS 上使用 Boost 和 Cocoapods?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29391805/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com