Qt compilation error: usr/bin/ld: cannot find LXXX

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.