Dynamic link libraries so some of the problems when compiling program

under linux development process, we often call the third-party DLL, you may often encounter can not find lxxx similar error.

There are three possible general this type of error.

First, there is no corresponding library program on your computer at the time of the dynamic link library not found naturally. Is not confirm this problem is very simple, use the find command to search. If not, the program can be installed so corresponding.

Second, there is a corresponding library on your computer, but not in the catalog compiled in the directory where the search. General / lib and / usr / lib directory search is fixed at compile time, and usually / usr / local / lib is not the default search directory. To solve this problem is very simple one: an increase in the makefile to compile a directory search, is done by way of -L directory, such as -L / usr / local / lib. Two: the so copied to the system directory search, but the search system are some of the general catalog of the library system is not recommended to copy your library to the directory, so chaotic. Three: Add search directory, create a file for example opencv.conf in /etc/ld.so.conf.d/ directory, then add the path .so file in the file, such as / usr / local / lib can a. Differences third embodiment and the first embodiment is that the first change of the current scan list compiler, and the third change is that all systems on the scan list compiler.

Third, there is the corresponding library, library catalog also compiled search directory on your computer. This situation is generally appear on the computer only libxxx.so.xx.xx.xx, without libxxx.so. The system is generally when searching libxxx.so search, which would not search for the DLL. The solution is simple, create a soft link, pointing to a new libxxx.so libxxx.so.xx.xx.xx present on the computer.

Generally the above three methods, which can solve the problem can not find the dynamic libraries.

Published 12 original articles · won praise 4 · views 20000 +

Guess you like

Origin blog.csdn.net/wuzhidefeng/article/details/103053287