^_^

2009年3月13日星期五

C in linux: error while loading shared libraries的解決方法

在linux c编程时如果遇到像下列這種錯誤:
./tests: error while loading shared libraries: xxx.so.0: cannot open shared object file: No such file or directory.
那就表示系統不知道xxx.so 放在哪個目錄下。

這個時候就要在/etc/ld.so.conf中加入xxx.so所在的目錄。一般而言,有很多so檔會在/usr/local/lib這個目錄下,所以在/etc/ld.so.conf中加入/usr/local/lib這一行,可以解決此問題。
include ld.so.conf.d/*.conf
/usr/local/lib
將 /etc/ld.so.conf存檔後,還要執行「/sbin/ldconfig -v」來更新一下才會生效。
本站文章除注明外,均为本站原创
转载请注明文章转载自: 大笨熊乐园 [ https://blog.foolbear.com/ ]
文章标题: C in linux: error while loading shared libraries的解決方法
文章地址: https://blog.foolbear.com/2009/03/c-in-linux-error-while-loading-shared.html

没有评论 :

发表评论

Related Posts with Thumbnails