PDA

View Full Version : Cannot mix incompatible Qt library



jstarr
4th October 2018, 20:24
I created a new Qt-Widget project, built it, put the windows.dll where it belonged, and tried to run it. I got the error:

Cannot mix incompatible Qt library (version 0x50402) with this library (version 0x50401)

I have only Qt 5.4.2 installed. I did not make any change to the project in the very simple form in which QtCreator created it.

My Qt Creator is:
Qt Creator 3.4.1 (opensource)
Based on Qt 5.4.2 (MSVC 2013, 32 bit)
Built on May 28 2015 19:07:19
From revision 29d81424a2

In the same directory as this project, I have another project created and built with the same Creator, and it works fine.

What could be the difference?

d_stranz
4th October 2018, 23:36
put the windows.dll where it belonged

You must use the Qt DLLs that come from your Qt install bin directory, not the Qt Creator installation directory. If you are copying files from Qt Creator's install directory these could be different from those in your Qt distribution. Qt Creator is standalone and uses its own set of DLLs, which could be different from your Qt distribution.

Also check to see that your PATH variable is pointing to the right place - your Qt install bin directory and not somewhere else.

jstarr
6th October 2018, 19:41
Qt Creator is coming from within the QT5.4.2 directory hierarchy. I tried adding its bin to the PATH, but no help. I don't think I can completely remove 5.4.2 from the path or other things will break. If it's all installed together, why would there be this problem?

Is there some way to get Creator to tell me what library is in question and where it's actually getting the versions, rather than just saying that 5.4.1 and 5.4.2 are not compatible?

I ran Creator and created a brand-new project in exactly the same location with copies of exactly the same Windows dll as another project that works perfectly. The new project gets the incompatible-libraries error, even though they are in the same place and created with the same Creator.

d_stranz
7th October 2018, 01:06
Did you recently install another piece of software (unrelated to your Qt install) that might have inserted its path into your PATH environment variable? Check to make sure that new app didn't install its own set of Qt DLLs that are being found before yours are.

I don't use Qt Creator enough to know, but when you run a program in the debugger using Visual Studio, it lists the full path to every DLL it loads or unloads. That's how I discovered a similar problem - there was an older version of Qt that was being found before the one I built against, and that was causing runtime errors. I would be surprised if Qt Creator didn't have some traceback like this as well.