How can I use Google-RE2 in C++ on ubuntu?

35 Views Asked by At

I have installed re2 in ubuntu. I want to use it in my C++ project. the simple code is as follows:

#include <iostream>
#include <re2/re2.h>

using namespace re2;
using namespace std;

int main()
{
    string s,t;
    if(RE2::FullMatch("hello", "h.*o"))
        cout << "s:"<< s << " t:"<< t ;
    else
        cout << "Not match." ;
    return 0;
}

but I got this error:

In function bool re2::RE2::FullMatch<>(absl::string_view, re2::RE2 const&)': main2.cpp: undefined reference to `re2::RE2::FullMatchN(absl::string_view, re2::RE2 const&, re2::RE2::Arg const* const*, int)

Can anyone help me ?

0

There are 0 best solutions below