首页 新闻 会员 周边

vs2010 boost fatal error LNK1120: 3 unresolved externals

0
悬赏园豆:5 [待解决问题]

代码

#include "boost/regex.hpp"
#include "string"
#include <iostream>

int main()
{
 boost::regex reg("([A-Z][a-z]*)");

 std::string str = "HelloWorld";
 boost::smatch what;

 std::string::const_iterator it=str.begin();
 std::string::const_iterator end = str.end();
 while(boost::regex_search(it,end,what,reg))
 {
  for (int i=0;i<what.size();++i)
  {
   std::cout<<what[i];
   std::cout<<std::endl;
  }
  it=what[0].second;
  
 }

 return 0;
}

错误信息:

1>RegexMain.obj : error LNK2019: 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) referenced in function "public: 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> > >::assign(char const *,char const *,unsigned int)" (?assign@?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@QAEAAV12@PBD0I@Z)


1>RegexMain.obj : error LNK2019: 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)" (?find@?$perl_matcher@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAE_NXZ) referenced in function "bool __cdecl boost::regex_search<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> > > >,char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >(class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class boost::match_results<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> > > > > &,class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >)" (??$regex_search@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@YA_NV?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$match_results@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@@0@ABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@0@W4_match_flags@regex_constants@0@0@Z)

1>RegexMain.obj : error LNK2019: unresolved external symbol "private: void __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> > >::construct_init(class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags)" (?construct_init@?$perl_matcher@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@AAEXABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@3@W4_match_flags@regex_constants@3@@Z) referenced in function "public: __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> > >::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> > >(class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class boost::match_results<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> > > > > &,class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$perl_matcher@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAE@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$match_results@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@@2@ABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@2@W4_match_flags@regex_constants@2@0@Z)

1>D:\Users\Documents\Visual Studio 2010\Projects\Hello\Debug\Regex.exe : fatal error LNK1120: 3 unresolved externals

宋骏的主页 宋骏 | 初学一级 | 园豆:185
提问于:2011-08-31 11:19
< >
分享
所有回答(1)
0

这个问题应该是你告诉编译器头文件在哪,但是连接器没找到文件、你配置一下工程属性然后在看看。

Rollen Holt | 园豆:210 (菜鸟二级) | 2012-05-03 16:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册