动态库链接问题
今天做个测试
>g++ -g time.c -I/home/lixy/source/ev/include -L/home/lixy/source/ev/lib -lev
>./a.out
./a.out: error while loading shared libraries: libev.so.4: cannot open shared object file: No such file or directory
/home/lixy/source/ev/lib这个目录下有libev.so文件,我生成一个libev.so.4文件就没有问题。
我有个疑问程序为什么不是加载libev.so文件,而是加载libev.so.4文件
[解决办法]
error while loading shared libraries: libev.so.4: cannot open shared object file: No such file or directory
不是说的很清楚么,他连接的是 libev.so.4,而你工作路径下无这个文件。
至于你说的为什么不是加载libev.so,估计是你写错了吧。
[解决办法]
ldd 看一下就清楚了
[解决办法]