Xcode 5.1.1 and Boost
Xcode 5.1.1 and Boost
通过向项目添加.dlib文件(boost(解决了问题
我正在尝试通过Homebrew将Boost 1.55连接到Xcode 5。Brew按照应该的方式安装了它。在/usr/local/include&//usr/local/lib在Boost头文件和库中出现了别名。
Xcode"搜索路径"设置:https://i.stack.imgur.com/itW83.pnghttps://i.stack.imgur.com/pO0n9.png
但当我尝试编译一个简单的例子:
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
int main()
{
const regex expression( "How to re" );
string string1 = "How to re";
bool match=regex_match(string1,expression);
if (match){
cout<<"Yes"<<endl;
}
return 0;
}
错误:
体系结构x86_64的未定义符号:"boost::basic_regx>
::do_assign(char const*、char const*,unsigned int(",引用自:boost::basic_regex>>::assign(char const*、char const*,unsigned int(在main.o"boost::re_detail::get_mem_block(("中,引用自:boost::re_detail::perl_matcher,std::__1::分配器>>,boost::regex_traits>::extend_stack((在main.o中boost::re_detail::save_state_init::save_state_init,boost::re_detail::saved_state**(。o
"boost::re_detail::put_mem_block(void*(",引用自:boost::re_detail::save_state_init::~save_stateinit((在main.o中boost::re_detail::perl_matcher,std::__1::分配器>>,boost::regex_traits>::unund_extra_block(bool(in main.o"boost::re_detail::verify_options(unsigned int,boost::regex_constants::_match_flags(",引用自:boost::re_detail::perl_matcher,std::__1::分配器>>,boost::regex_traits>::match_imp((。o"boost::re_detail::raise_runtime_error(std::runtime_errorconst&(",引用自:void boost::re_detail::raise_error>>(boost::regex_traits_wrapper>>常量&,boost::regex_constants::error_type(。o
"boost::re_detail::get_default_error_string(boost::regex_constants::error_type(",引用自:boost::re_detail::cpp_regex_traits_iimplementation::error_string(boost:;regex_constants::error_type(常量在main.o
"boost::re_detail::cpp_regx_traits_implementation::transform_primary(char const*,char const*(const",引用自:boost::cpp_regx_traits::transform_primary(char const*,char const*(const in main.o
"boost::re_detail::cpp_regx_traits_iimplementation::transform(charconst*,char const*(const",引用自:boost::cpp_regx_traits::transform(char const*,char const*(const in main。o ld:找不到体系结构的符号x86_64 clang:错误:链接器命令失败,退出代码为1(使用-v参见调用(
真的很累,所以,请你帮忙。
谢谢,-Philipp
您有几个选项,但所有选项都涉及到将库libboost_regex
添加到项目中以解决链接错误。即使您使用自制软件安装了boost,您仍然需要将库添加到您的项目中,因为boost的regex代码包含已编译的部分。如果不添加库,链接器就无法解析符号。
第一个选项是将/usr/local/lib
添加到库搜索路径,并将-lboost_regex
添加到其他链接器标志。如果选择此选项,您可能还需要将/usr/local/lib
添加到运行路径搜索路径中。此方法将链接到/usr/local/lib
中的动态库。
如果您希望您的程序是自包含的,您可以链接到静态(.a
(版本的boost_regex
。为此,请在构建设置-将二进制与库链接中将libboost_regex.a
添加到您的项目中。
- SWIG and Boost::variant
- boost::lockfree::spsc_queue and boost::asio
- boost.spirit x3 move_to and list ast member
- Use boost strand and std::mutex
- boost::spirit::qi and boost::phoenix::push_back
- boost::filesystem::path.parent_path() and whitespace
- Boost mpl::vector and hana
- 为什么BOOST :: fileSystem :: path and std :: filesystem ::路径含量含
- Boost Asio and OpenSSL 1.1.0
- Difference between boost::thread and std::thread
- Boost cpp and Visual Studio 2015
- boost::range_iterator and boost::iterator_range confusion
- Natvis Visual Studio 2012 Boost Vector and Matrix
- BOOST :: simel_lock and Boost :: shared_lock for读者作者锁
- C++, TR1, Regex and Boost
- Flask, boost::python and threads
- ffmpeg and boost::asio NULL pointer
- Boost:bind and Boost::function
- Boost, Windows, and QtCreator
- CLion and Boost 1.60.0