boost regex help

closed account (Dy7SLyTq)
i am about to tear my hair out because i can't find the answer. here is the code where the problem is:

1
2
3
4
5
6
7
8
9
vector<Token> Lex(vector<string> &FileContents)
{
     vector<Token> TokenList;
     static const boost::regex Search("function");

     TokenList.push_back(Token("n/a", "n/a", -1));

     return TokenList;
}


line 6 is just a test to see if its printing right and can be ignored. im getting the errors:


/tmp/ccNi6hdi.o: In function `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int)':
main.cpp:(.text._ZN5boost11basic_regexIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j[_ZN5boost11basic_regexIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j]+0x2a): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
collect2: error: ld returned 1 exit status


edit:
i cant figure out what i need for the second constructor
Last edited on
assign is (unsurprisingly) invoked on assignment.

The only place you have assignment here is on the line you tell us we can ignore.

It would appear that you are not linking to the appropriate library. boost_regex is not a header only library.
closed account (Dy7SLyTq)
oh ok thanks. i didnt see it on the list of headers that need to be compiled so i will do that
Topic archived. No new replies allowed.