Hi,
I am trying to execute below program. It is building fine but am getting 2 linker errors:
Kindly help me.
#include <iostream>
#include <iterator>
#include <regex>
#include <string>
using namespace std;
int main()
{
std::string text = "Quick brown fox";
std::regex vowel_re1("a|e|i|o|u");
std::regex_replace(std::ostreambuf_iterator<char>(std::cout),
text.begin(), text.end(), vowel_re1, "*");
std::cout << '\n' << std::regex_replace(text, vowel_re1, "[$&]") << '\n';
}
Linker errors:
myClient.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct>,class std::allocator<char> > __cdecl std::tr1::regex_replace<class>,char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct>,class std::allocator<char> > const &,class std::tr1::basic_regex<char,class> > const &,char const *,enum std::tr1::regex_constants::match_flag_type)" (??$regex_replace@V?$regex_traits@D@tr1@std@@DU?$char_traits@D@3@V?$allocator@D@3@@tr1@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@ABV21@ABV?$basic_regex@DV?$regex_traits@D@tr1@std@@@01@PBDW4match_flag_type@regex_constants@01@@Z) referenced in function _main
1>myClient.obj : error LNK2019: unresolved external symbol "class std::ostreambuf_iterator<char,struct> > __cdecl std::tr1::regex_replace<class> >,class std::_String_iterator<char,struct>,class std::allocator<char> >,class std::tr1::regex_traits<char>,char>(class std::ostreambuf_iterator<char,struct> >,class std::_String_iterator<char,struct>,class std::allocator<char> >,class std::_String_iterator<char,struct>,class std::allocator<char> >,class std::tr1::basic_regex<char,class> > const &,char const *,enum std::tr1::regex_constants::match_flag_type)" (??$regex_replace@V?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@V?$_String_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@2@V?$regex_traits@D@tr1@2@D@tr1@std@@YA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@1@V21@V?$_String_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@1@1ABV?$basic_regex@DV?$regex_traits@D@tr1@std@@@01@PBDW4match_flag_type@regex_constants@01@@Z) referenced in function _main
1>C:\Users\smallesh\Documents\Visual Studio 2010\Projects\C#\Client\Debug\Client.exe : fatal error LNK1120: 2 unresolved externals