When C/C ++ProgramDuring compilation or connection, errors such as error while loading shared libraries are often displayed. The main reason is that a dynamic or static library cannot be found. This situation is often caused by the use of function libraries other than the system library.
I encountered an error when using Libpcap. This is because the function library is usually installed. When the make install method is used, the. So file and. A file of the function library will be copied to/usr/local/lib by default. However, this path is not in the path of the connected database of the system. Therefore, an error occurs.
Solution: Add "/usr/local/lib" to the end of the/etc/lD. So. conf file, and run/sbin/ldconfig-V as the root user. Where/etc/lD. so. the conf file records the path of the library to be dynamically connected during compilation. The ldconfig command is mainly used in the default search directory (/lib and/usr/lib) and the dynamic library configuration file/etc/lD. so. under the directory listed in Conf, search
Obtain the shared dynamic link library (the format is as described earlier, lib *. so *) to create a dynamic loader (LD. so) the required connection and cache file. the default cached file is/etc.
/LD. So. cache, which saves the list of sorted Dynamic Linked Library names. See http://www.xxlinux.com/linux/article/accidence/technique/20081230/14754.html