如何在 XCode 6.0 中将 Boost 库添加到我的 C++ 程序中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27470462/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:21:39  来源:igfitidea点击:

How do I add the Boost library to my C++ program in XCode 6.0?

c++xcodeboost

提问by Satya Nadella

I'm using XCode6.0 and need the boostlibrary for program. I have downloaded boost_1_57_0.tar.gzfrom http://sourceforge.net/projects/boost/files/boost/1.57.0/and have unarchized it. Now I just need to somehow get it into my program so that

我正在使用XCode6.0 并且需要boost程序库。我已经boost_1_57_0.tar.gzhttp://sourceforge.net/projects/boost/files/boost/1.57.0/下载并解压了它。现在我只需要以某种方式将它放入我的程序中

#include "boost/filesystem.hpp"
using boost::filesystem;

works. I looked at the instructions http://freddy.cellcore.org/post/79587278354/boost-c-libraries-on-osx-xcode-5, which are for XCode 5, and I can't seem to find the equivalent "Build Phases" panel in XCode 6.

作品。我查看了用于 的说明http://freddy.cellcore.org/post/79587278354/boost-c-libraries-on-osx-xcode-5XCode 5我似乎找不到等效的“构建阶段" XCode 6 中的面板。

Upvotes to anyone who can offer me help.

向任何可以为我提供帮助的人点赞。

回答by Richard Hodges

  • here's a screenshot demonstrating how I do it:
  • 这是一个截图,展示了我是如何做到的:

then include boost headers like so:

然后像这样包含 boost 标头:

#include <boost/filesystem.hpp>

enter image description here

在此处输入图片说明

To get to the build settings, ensure your project view is open on the left, and then click on the actual target (the one highlighted in this picture)

要进入构建设置,请确保您的项目视图在左侧打开,然后单击实际目标(图中突出显示的目标)

enter image description here

在此处输入图片说明

If you can't even see that it's because you have to press this stupid, almost-invisible button here (third from right - looks like a vertical line inside a box):

如果你甚至看不到那是因为你必须在这里按下这个愚蠢的、几乎不可见的按钮(右数第三个 - 看起来像盒子里的一条垂直线):

enter image description here

在此处输入图片说明