The QT program developed under win10 runs incorrectly on win7
-
I compiled the application with QT creator (qt6.2+MSVC) on win10, and then put the application on win7 to run, and reported the error "The program input point createdxgifactory2 cannot be located in dxgi.dll". QT official website says that win7 does not support QT (version 6.2) development, so I developed it on win10. I once considered compiling the whole QT and QT program in MT mode, but it is not recommended to do so on QT wiki. Via depends.exe, dxgi.exe from win7 does not contain the createdxgifactory2 function, but win10 does. I put dxgi.dll from win10 into the application directory, but the problem still exists, indicating that the application is looking for dxgi.dll from win7 system path. In addition, msvcrt.dll also could not find _free_Locale function. I want to clarify the following questions: 1. Whether the application compiled with QT (version 6.2) on win10 supports running on win7? 2. Is there a way for applications to find these system libraries in the application directory first? 3.Is there any way to solve my current problems? I look forward to your reply, thank you!
-
@bergerac said in The QT program developed under win10 runs incorrectly on win7:
- Whether the application compiled with QT (version 6.2) on win10 supports running on win7?
QT official website says that win7 does not support QT (version 6.2) development, so I developed it on win10.
Where do you claim the site says it is only development which does not support Windows 7? https://doc.qt.io/qt-6/windows.html just says
The following Windows configurations are supported in Qt 6.2:
Operating System Architecture Compiler
Windows 10 (1809 or later) x86_64 MSVC 2019, MinGW 11.2
Windows on ARM arm64 MSVC 2019 Technology Preview
I believe that to mean you cannot target Windows 7, regardless of development platform
3.Is there any way to solve my current problems?
Use Qt 5.x instead of 6.x.
-
Hi, as @JonB says, officially Qt6 does not work on Windows7.
To make it work, 2 choices:
- Bend Windows7 to your will.
- Bend Qt6 to your will.
I can assure you that choice 1 is enormously harder than choice 2 :-)
I had more or less the same problem as you, I wanted to use Qt 6 on Windows 7. So I downloaded the source for Qt 6.2.2, edited it and rebuilt it with MSVC 2019 to work on Windows 7. Turns out only 3 .dlls needed to change, if you want to try you can download these patched versions, for more see https://forum.qt.io/topic/133002/qt-creator-6-0-1-and-qt-6-2-2-running-on-windows-7
The patches I made included a fix for that dreaded "missing CreateDXGIFactory2 function" error: the code in Qt5 checks if it's running on Windows 10 or later, if it's not it uses CreateDXGIFactory1 instead (which works fine on Windows 7). In Qt6 this check is removed and it assumes it always runs on Windows 10 or 11.
In total there were say 5 similar patches needed, mostly solved by copying back the code from Qt5 into Qt6. I will probably patch the upcoming Qt 6.2.3 in the same way, but this is an uphill battle, perhaps in Qt 6.4 or 6.5 there will be some new functions that requires Windows 10, we'll see...Anyway, these cleanups are understandable, it reduces code bloat and runtime overhead. On the other hand, consider:
You can install a new Firefox on Windows XP (and Windows 7).
The new Visual Studio 2022 installs and works fine on Windows 7.
However, Microsoft and Mozilla are bigger companies with more resources. -
Thanks @JonB and @hskoglund. @hskoglund , I followed your advice and downloaded the QT(6.2.1) installation package from the QT official website, but an error which said "Error during installation process (qt.qt6.621.win64_msvc2019_64): Running "E:\Qt\6.2.1\msvc2019_64\bin\qmake.exe" resulted in a crash." was reported on win7. Have you ever encountered this problem?Thank you again for your reply.
-
Yes, see my older post this error is to be expected since the MaintenanceTool tries to launch qmake for an unpatched 6.2.2 on your Windows 7.
Just click "Ignore" (have to do it two times), then 6.2.2 should be installed anway. Then you can try downloading my zip and replacing Qt6Core.dll, Qt6Gui.dll and qwindows.dll... -
@hskoglund, I replaced the three libraries according to the steps by
https://forum.qt.io/topic/133002/qt-creator-6-0-1-and-qt-6-2-2-running-on-windows-7, and then ran QT creator ,
but there was an error “This application failed to start because no Qt platform plugin could be initialized.
Reinstalling the application may fix this problem.Available platforms plugins are:direct2d,minimal,offscreen,windows.”
Have you ever encountered this error? -
@bergerac
While you wait for a specific solution from @hskoglund .Whenever you get "no Qt platform plugin could be initialized", to diagnose set environment variable
QT_DEBUG_PLUGINS=1
in a shell/terminal and then run your application. You should get a stream of diagnostic output. Look right near the end for whatever the cause of your final problem is. -
Hi @bergerac most likely you successfully replaced Qt6Core.dll and Qt6Gui.dll but not qwindows.dll.
If you look in your C:\Qt\Tools\QtCreator\bin\plugins\platforms folder, the original qwindows.dll is from November 23, 2021 with a size of 780568 bytes.
My patched version is from December 21. 2021 with a size of 763904 bytes.If you have the one from November that could explain the error "The application failed..."
Otherwise you can try following the advice from @JonB -
Hi @hskoglund @JonB
DbgView.exe shows the information
"[28200] qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.
[28200] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
[28200] Available platform plugins are: direct2d, minimal, offscreen, windows." -
Hi @hskoglund @JonB
@hskoglund There was nothing else before that information.
@JonB I open cmd, enter "set qt_debug_plugins = 1", and then locate to the installation directory to run QT Creator.exe. -
Hi, the output should be a couple of thousand lines, the first one should be:
1 0.00000 [28200] QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Tools/QtCreator/bin/plugins/platforms" ...
don't need all thousands of lines, just say the 40 at the end...
-
@bergerac
There ought be preceding output.Try
SET QT_DEBUG_PLUGINS=1
, just in case capitals matter, though I suspect not under Windows, but don't know.locate to the installation directory to run QT Creator.exe.
That is not what I said. I said run the executable, not Creator. It is not apparent to me the variable will necessarily be passed to the application when run from there. If you do it that way you should look inside Creator where you see the "runtime environment variables" set up. Which is why running the program directly from the Command prompt is simpler.