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

David Burson picture David Burson · Aug 23, 2012 · Viewed 9.3k times · Source

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?

Answer

Bart picture Bart · Aug 23, 2012

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).