将Boost库链接到Xcode项目
linking Boost library to Xcode project
我正在尝试创建一个使用Boost库的项目。我使用的是OS X 10.9.5(我应该更新一下),使用的是Xcode 6.2。我用自制的brew install boost
安装了boost,它位于/usr/local/Cellar/boost/1.59.0
中。我在Xcode中的头搜索路径中添加了/usr/local/Cellar/boost/1.59.0/include
路径,它似乎能识别它,因为自动完成提示是有效的。
在boost文档中,它提到必须先构建一些boost库,然后才能使用它们。我想自制软件已经处理好了,因为我在/usr/local/Cellar/boost/1.59.0/lib
中有一堆.a
和.dylib
文件
我还是C++和Xcode构建过程的新手,但似乎我仍然需要将编译的库链接到我的项目。我尝试将路径/usr/local/Cellar/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)
我还需要配置其他东西才能使其工作吗?
添加路径是正确的,但您还需要指定所需的库。在命令行中,您可以使用-l,以便在Xcode中将它们添加到Other Linker Flags
中。
您需要的库是boost_filesystem
和boost_system
。
相关文章:
- 是否可以在 Xcode C++项目中包含框架?
- 如何使用可执行文件将我的C++代码合并到我的 Xcode 项目中
- 将Qt导入到现有的Xcode项目中
- 将框架包括在Xcode C 项目中 - 链接器错误
- 错误的同时将C 文件夹在iOS XCode项目中包括在内
- 如何在Xcode项目中使用dlib face_recognition
- 如何在 Xcode 项目导航器中显示.txt文件
- Xcode & C/C++ 项目
- 使用 waf 生成 xcode 项目
- 如何在 Xcode 项目中包含 libzip 库
- "Extra ';' " Xcode C++项目中的编译错误
- 在Xcode c++项目中包含头文件
- Boost序列化:XCode 5项目中的链接器错误,由CMake生成(带最小完整示例)
- 将 Xcode 项目与 MathGL 链接时的语义问题
- 如何在 C++ xcode 项目中使用动态共享库
- 当我在xcode项目中使用 #include < OpenGL/gl.h>行时,它会在哪里查找gl.h文件?
- 将Boost库链接到Xcode项目
- 在xcode C++项目中编译为C99文件
- 在一个Xcode项目中运行多个具有主功能的文件
- 无法在XCode 4项目中的c++嵌入中安装libjson