我使用下面的代碼來測試谷歌的RE2庫RE2庫加載
int main()
{
int r = RE2::FullMatch("hello", "h.*o");
cout <<" match = " << r << endl;
return 0;
}
我使用下面的命令compling -
g++ -lre2 -o retest retest.cc
它正在編制很好,但是當我試圖運行重新測試./retest其拋出以下錯誤 -
error while loading shared libraries: libre2.so.0: cannot open shared object file: No such file or directory
我已檢查和libre2.so.0庫存在於user/local/lib目錄和re2/obj/so目錄中。那麼,爲什麼這個錯誤是我忘了一些細節添加?
這是一個解決方案嗎? http://edn.embarcadero.com/article/32861。只需將您的LD_LIBRARY_PATH設置爲指向libre.so.0所在的lib目錄即可。 – Lucian
位於哪裏是libre2.so.0文件?它在你的'LD_LIBRARY_PATH'和/或來自/etc/ld.so.conf的路徑中嗎?安裝後你運行了ldconfig嗎? – PlasmaHH
[Linux加載共享庫時出錯:無法打開共享目標文件:沒有這樣的文件或目錄]可能的重複(http://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot -open-shared-object-file-no-s) –