문제

I am using the following code to test google's RE2 library

int main()
{
  int r = RE2::FullMatch("hello", "h.*o");
  cout <<" match = " << r << endl;
  return 0;
}

I am compling using the following command -

g++ -lre2 -o retest retest.cc

It is compiling fine, but when I am trying to run retest with ./retest its throwing the following error -

error while loading shared libraries: libre2.so.0: cannot open shared object file: No such file or directory

I have checked and libre2.so.0 library does exist at user/local/lib directory and re2/obj/so directory. So why is this error coming am I forgetting some detail to add ?

도움이 되었습니까?

해결책

Running sudo ldconfig did the trick.

다른 팁

Classic pitfall:

g++ -o retest retest.cc -lre2 

The libraries should be last

Edit to be honest I'm surprised at the absence of link errors. I'll keep it around in case you missed some information in the question

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top