我在连接Boost Regex时遇到问题,尽管我可以运行(编译/链接)其他Boost程序.
我意识到这是"记录良好"但我找不到答案,因为各个帖子使用不同版本的Boost,不同的编译器,使用bjam(我使用过b2),似乎暗示我已经尝试过的等等.
Visual Studio 10(我使用的是C++)
提升版本:1.53.0
初始安装:我遵循了如何在Visual Studio 2010中使用Boost(我一直到第二点4).我没有下载ICU对Regex的支持,因为我认为只有在需要Unicode支持时才需要这样做?
我通过更新"包含目录"并添加C来将相关库包含在项目属性中:.......\Boost\boost_1_53_0
我通过添加"C:.....\Boost\boost_1_53_0\stage\lib"将相关目录包含在项目属性库目录中,以便它知道库的链接位置(至少这是我的想法)这样做).
我可以使用(例如)Boost随机数编译,链接和运行程序.
如果我试图添加正则表达式功能,请说:
boost::algorithm::split_regex( result, str, regex( "[0-9]+|->" ) )
Run Code Online (Sandbox Code Playgroud)
我得到以下形式的链接错误.
1>Bibtex.obj : error LNK2001: unresolved external symbol "private: class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > & __thiscall boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::do_assign(char const *,char const *,unsigned int)" (?do_assign@?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@AAEAAV12@PBD0I@Z)
1>Bibtex.obj : error LNK2001: unresolved external symbol "public: bool __thiscall boost::re_detail::perl_matcher<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::find(void)" …
Run Code Online (Sandbox Code Playgroud)