32-bit Qt application on win 7 x64 won't run, but runs fine from Qt Creator?
Asked Answered
H

4

5

My development box is Windows 7 x64. I have both 32-bit and 64-bit versions of Qt 4.7.4 built on my box. When I configure my app to use the 32-bit version of Qt, it runs fine in Qt Creator (ctrl-R), but when I try to double-click the exe in Windows Explorer (or run from cmd prompt), I get:

---------------------------
RenameTemplatePreviewFiles_Qt_win.exe - Application Error
---------------------------
The application was unable to start correctly (0xc000007b). 
Click OK to close the application. 
---------------------------
OK   
---------------------------

If I switch my configuration to 64-bit Qt and build it, I can double-click the exe and it runs fine.

What do I need to do to be able to run the exe compiled with 32-bit Qt?

Hageman answered 23/8, 2012 at 20:2 Comment(3)
Are you linking dynamically or statically against Qt?Eldredge
I'm not sure - how can I tell?Hageman
If you are using default configuration so you are linking dynamically against Qt (Check linker command to be sure). If linking is dynamic so the application will search for Qt dll near the application then in the PATH. If linking is static Qt is embedded in your application. In your case I guess it's dynamic and 32bit Qt dll are not present in the PATH. Try to copy QtCore4.dll in your application folder and refer to Bart answer to find all Qt dependenciesEldredge
K
5

My somewhat educated guess would be that your application can simply not find the required DLLs. To be sure, you could open your exe in Dependency Walker to see if it finds all the necessary DLLs. If nothing seems amiss at first, then use Dependency Walker to profile the application. This might reveal some missing dependencies loaded at run-time.

If this relates to your Qt DLLs, make sure that there is either an appropriate entry within your PATH environment variable, or that the required DLLs are included in your EXE's directory (though the latter might not be the best choice on a development machine).

Kirman answered 23/8, 2012 at 20:49 Comment(2)
yup, only the x64 version of Qt is in my path. However, the x86 version of Qt is in my path, if I look in Qt Creator - Projects, Build Settings, Build Environment. It's set to Use System Environment, but apparently it automatically adds the x86 version of Qt to the path.Hageman
@DavidBurson Yep, that was most likely it. Glad to see that's resolved.Kirman
S
1

I have faced same issue. First I copied required .dll files in release folder where my .exe file exists. Then I copied extra libstdc++-6.dll file. Program started working after this.

Sevilla answered 24/5, 2019 at 10:50 Comment(1)
Thx veryy much you've saved me!Cashbook
A
0

Simply add the three missing dll files:

  • libwinpthread-1.dll
  • libstdc++-6.dll
  • libgcc_s_dw2-1.dll

to the folder of appl.exe . For my system, that would be into the directory C:\Users\H\Documents\build-AQtest01v4-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug. Copying those libraries should make your application work. On my system those dlls can be found in C:\Qt\Tools\mingw492_32\bin.

Actor answered 14/4, 2018 at 15:4 Comment(0)
K
0

I did run into the same problem and would like to share my solution.

When I tried deploying the 32-bit version, running windeployqt.exe copied over the wrong files for the 32-bit executable as the PATH was set to the 64-bit bin folder (D:\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin).

When I set the PATH to the 32 bit folder (D:\Qt\Qt5.14.2\5.14.2\msvc2017\bin) and run windeployqt.exe again, the correct files were copied for deployment and everything worked.

Gary

Kaolack answered 27/11, 2020 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.