Problem:
When compiling an application or lib source code in a Linux environment, the following error message is often displayed:
/Usr/bin/ld: cannot find-LXXX
These messages have different results as different types of source code are compiled, as shown in figure
A small program compiled by myself for VLC appears
Error message for usr/bin/ld: cannot find lvlc
Caused by the lack of a static Link Library
Other images
/Usr/bin/ld: cannot find-lC
/Usr/bin/ld: cannot find-lltdl
/Usr/bin/ld: cannot find-lxtst
And so on.
Xxx indicates the name of the library file. For example, the names of libc. So, libltdl. So, and libxtst. So are C, ltdl, and xtst.
The naming rule is: Lib + Library name (XXX) +. So.
There are three possible causes:
1. The system has not installed the corresponding lib
2. The corresponding lib version is incorrect.
3. the symbolic link of LIB (. So file) is incorrect and is not linked to the correct library file (. So)
Solution:
(1) first judge whether the symbolic link of the corresponding library file (. So) under/usr/lib is correct
If the Link Target is incorrect, the problem can be solved.
(2) If the problem is not caused by symbolic link, but the system lacks the corresponding lib to install Lib, it can be solved.
(3) how to install the missing Lib:
The preceding three error messages are used as an example:
Error 1 lib of libc missing
Error 2 lib of libltdl missing
Error 3: libxtst lib missing
Take Ubuntu as an example:
Search for the corresponding lib before installing the job, for example:
Apt-cache search libc-Dev
Apt-cache search libltdl-Dev
Apt-cache search libxtst-Dev
Instance:
When compiling the source code of the Input Method gcin, the following error message is displayed:
/Usr/bin/ld: cannot find-lxtst
After inspection, we found that:
The symbolic link of LIB (. So file) is incorrect.
The solution is as follows:
CD/usr/lib
Ln-s libxtst. so.6 libxtst. So
If the libxtst. So file cannot be found in the/usr/lib directory, it indicates that the libxtst library is not installed.
The solution is as follows:
Apt-Get install libxtst-Dev
Check whether the path of the configuration file is correct in the QT pro file.