C++ 将Boost库链接到Xcode项目

C++ 将Boost库链接到Xcode项目,c++,xcode,boost,C++,Xcode,Boost,我正在尝试创建一个使用Boost库的项目。我使用的是OSX10.9.5(我应该更新一下),使用的是Xcode 6.2。我用自制软件安装了boost,它位于/usr/local/cillar/boost/1.59.0。我将路径/usr/local/cillar/boost/1.59.0/include添加到Xcode中的头搜索路径中,它似乎可以识别它,因为自动完成提示有效 在本文中,它提到一些Boost库必须先构建,然后才能使用。我想是自制软件解决了这个问题,因为我在/usr/local/cill

我正在尝试创建一个使用Boost库的项目。我使用的是OSX10.9.5(我应该更新一下),使用的是Xcode 6.2。我用自制软件安装了boost,它位于
/usr/local/cillar/boost/1.59.0
。我将路径
/usr/local/cillar/boost/1.59.0/include
添加到Xcode中的头搜索路径中,它似乎可以识别它,因为自动完成提示有效

在本文中,它提到一些Boost库必须先构建,然后才能使用。我想是自制软件解决了这个问题,因为我在
/usr/local/cillar/boost/1.59.0/lib
中有一堆
.a
.dylib
文件

<>我仍然是C++和XCODE构建过程的新手,但我仍然需要将编译库链接到我的项目。我尝试将路径
/usr/local/cillar/boost/1.59.0/lib
添加到项目的库搜索路径中,但我不确定这是否正确

这是我尝试构建项目时遇到的错误

Undefined symbols for architecture x86_64:
  "boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::system::error_code*)", referenced from:
      boost::filesystem::create_directory(boost::filesystem::path const&) in main.o
  "boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)", referenced from:
      boost::filesystem::exists(boost::filesystem::path const&) in main.o
  "boost::system::system_category()", referenced from:
      ___cxx_global_var_init2 in main.o
  "boost::system::generic_category()", referenced from:
      ___cxx_global_var_init in main.o
      ___cxx_global_var_init1 in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我还需要配置其他东西才能使其正常工作吗?

添加路径是正确的,但您还需要指定所需的库。在命令行上,您可以在Xcode中使用-l,将它们添加到
其他链接器标志中


您需要的库是
boost\u文件系统
boost\u系统

@Eelke太棒了!谢谢,我在我的项目的构建设置的
其他链接器标志
部分添加了这些标志,它成功了!如果你回答我会接受的你能给出准确的语法吗?我正在尝试使用boost并将
-l boost_bind
放在其他链接器标志部分,但仍然会在Xcode中出现“boost//bind.hpp file not found”错误(包括
#include
#include
失败),您缺少boost的include路径。无法提供详细信息,通过电话发帖。我绝对不会。我用
brew
安装了boost,它将boost编译成
/usr/local/cillar/boost
,我将
/usr/local/cillar/boost/1.65.1/include/
添加到我的头路径,并将
/usr/local/cillar/boost/1.65.1/lib/
添加到库搜索路径,但当我查看实际的编译指令时(使用Xcode的报告导航器)没有提及这些。所以我完全按照Xcode的要求添加了它们,然后它们就被完全忽略了。