Cannot find the library when running the program under linux

problem

./test: error while loading shared libraries: libcyusbserial.so: cannot open shared object file: No such file or directory 

Solution one

# echo “/home/root/workspace/cyusblib” >> /etc/ld.so.conf # 把库的路径添加到ld.so.conf文件末尾
# ldconfig # 使之生效

Solution two:

Configure the LD_LIBRARY_PATH environment variable

Solution three:

Put the library in the system directory to
/usr/lib
/usr/local/lib

to sum up

Each method has its own advantages and disadvantages. The last time you used solution one to solve the problem, you usually use solution two. Scheme 3 is rarely used.

https://blog.csdn.net/guotianqing/article/details/106804065

Guess you like

Origin blog.csdn.net/amwha/article/details/115066584