QT program error Cannot mix incompatible Qt library... solution

Debug the Qt program on the target machine, the compilation is no problem, when running the program, the program flashes back and gives an error message:

Cannot mix incompatible Qt library (version 0x40805) wiht this library (version0x40807)
Aborted (core dumped)

Reason analysis:
The literal meaning is: the incompatible Qt library (version 0x40805) and (version 0x40807) cannot be mixed; this shows that there are two versions of the Qt library in the current system, 485 and 487, which are loaded when the program runs A different version of the Qt library was installed, resulting in a runtime error. As for why different versions of the qt library are loaded, the reason is that the Qt library of the current environment variable lacks the Qt library files required for the program to run. At this time, the program will search for the corresponding Qt library in other environment directories and system directories, and find it. But the versions are different.

Use lddthe command on the executable program to conduct a comprehensive inspection of the libraries required for its operation to check whether there are different versions of the Qt library; if it does not exist, you can check your own so library, and if there are plug-ins, you can check Something went wrong.

Solution:
Just ensure that the same version of the Qt library is loaded when the program is running.

Method 1: Copy the missing Qt library (same version) to the corresponding environment variable folder.

Method 2: Enter the Qt installation directory, enter the lib folder, and back up the library files under it to the newly created file qt, so that when the program is running, all other versions of the Qt library will be loaded.
 example:

#cd  /usr/local/Trolltech/Qt-4.8.7/lib
#mkdir qt
#mv *Qt* qt

Guess you like

Origin blog.csdn.net/yulong_abc/article/details/128680650
Recommended