[root@zyh c編程]# gcc -o ldev ldev.c -lpcap
[root@zyh c編程]# ./ldevlinux
./ldev: error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory編程
(同時把之前安裝的libpcap刪除(指定路徑的安裝在編程時出現好些問題,不能正常使用,可能這樣安裝不對吧,具體why也沒時間研究了)。app
從新用#./configure #make # make install 安裝到系統默認路徑中去了。)ide
關於 error while loading shared libraries: libXXX.so.1.2.3: cannot open shared object file: No such file or directorygoogle
此時你能夠locate libXXX.so.1.2.3 (若是你的文件系統比之前有了變化,如安裝了多是須要的庫的開發包,則須要 locate -u 一下)spa
然 後若是發現了libXXX.so.1.2.3的確存在,就把libXXX.so.1.2.3所在的目錄加入到 /etc/ld.so.conf 中,或者在 /etc/ld.so.conf.d/ 下新建一文件,如 XXX.conf ,其內容是libXXX.so.1.2.3所在的目錄。開發
若是發現libXXX.so.1.2.3不存在,你可能沒安裝包含庫的程序。通常google一下「XXX linux」就能找到相應的軟件。it
若是提示是error while loading shared libraries: libXXX.so,但你的系統上有libXXX.so.5,你能夠爲libXXX.so.5class
作一個軟連接 ln -s libXXX.so.5 libXXX.sogcc
如,我執行一個ACE開發包中的樣例程序時,出現如下提示:
./logging_app: error while loading shared libraries: libACE.so.5.4.7: cannot open shared object file: No such file or directory
[root@lf ld.so.conf.d]# locate libACE.so.5.4.7
/opt/ace/ace/libACE.so.5.4.7
/opt/ace/lib/libACE.so.5.4.7
[root@lf ld.so.conf.d]# vi ace.conf
ace.conf中只有一行: /opt/ace/lib