Important: Please read the Qt Code of Conduct -

QPixmap load fails on WinXP SP3?

  • I wrote a small photo resizer program and it works fine on Win Vista and Win 7, but fails to read the JPG files on Win XP Sp3.

    Look in files and choose the Windows Installer, or examine the source.

    I do not have access to WinXP all the time, so it will be some time before I can run a debugger on such a system, but my friends need this resizer and can't use it since it fails.

    Any ideas? Strange error don't you think.
    BTW, I thought it might be a limitation with image size, so I tried a small image [800pix] on the Win XP system and that failed too, so just looks like a system incompatibility in the library.


  • I looks that you forgot about the Qt's jpeg plug-in, so have you included it in the installation package?
    "doc": on how to create the deployment package on windows.

    I think the file is in Qt_SDK_INSTALL_DIR\qt\plugins\imageformats and it's called qjpeg4.dll and you should copy it in a folder called plugins that should be in the folder where you install the application, but i didn't have to deploy an application with plug-ins, so this is just my opinion, please correct me if i'm wrong

  • I looked at the InnoSetup script. You should add the image format plugins to your installer package.

    You should add this to your InnoSetup script:


    Source: C:\Code\PhotoResizerQt-build-desktop\release\plugins\imageformats\qgif4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: C:\Code\PhotoResizerQt-build-desktop\release\plugins\imageformats\qico4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: C:\Code\PhotoResizerQt-build-desktop\release\plugins\imageformats\qjpeg4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: C:\Code\PhotoResizerQt-build-desktop\release\plugins\imageformats\qmng4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: C:\Code\PhotoResizerQt-build-desktop\release\plugins\imageformats\qsvg4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: C:\Code\PhotoResizerQt-build-desktop\release\plugins\imageformats\qtiff4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion

    Are you really sure your Qt libs are in "C:\Code\PhotoResizerQt-build-desktop\release"? That seems to be the build directory of your application, not the install dir of the Qt libs.

  • Ok. I spaced that...
    When I ran the app with a double click from the release folder, of course some DLLs were missing.
    Soooo... I figured that when I resolved all of those, I had it ready to go. I'll check into this.

    I test to make sure I have all the DLLs I need by copying them to the Release folder. When the app runs I figure I have all that I need and then I build the installer from there. Looks like either I didn't completely test the app from the release folder or it found the plugins anyway.


  • The plug ins are loaded from either the Qt installation dir or from the plugins folder near the application executable. So your app runs fine on the development machine because the plug ins are found in the Qt dir.

  • Woops...
    This does not work.
    I installed the program on a Vista x64 system where Qt has not been installed and it fails.
    The plugins are as you suggest. But no dice.

    Based on this page:
    It looks like I can statically link against the plugins, so I'm going to try that next.

    • windy

  • For my projects it is sufficient to include this into the InnoSetup script:

    #define QtDir "C:\Qt\4.7.0"

    Source: {#QtDir}\bin\QtCore4.dll; DestDir: {app}; Flags: ignoreversion
    Source: {#QtDir}\bin\QtGui4.dll; DestDir: {app}; Flags: ignoreversion

    Source: {#QtDir}\plugins\iconengines\qsvgicon4.dll; DestDir: {app}\plugins\iconengines; Flags: ignoreversion

    Source: {#QtDir}\plugins\imageformats\qgif4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: {#QtDir}\plugins\imageformats\qico4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: {#QtDir}\plugins\imageformats\qjpeg4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: {#QtDir}\plugins\imageformats\qmng4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: {#QtDir}\plugins\imageformats\qsvg4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion
    Source: {#QtDir}\plugins\imageformats\qtiff4.dll; DestDir: {app}\plugins\imageformats; Flags: ignoreversion

    Does the program actually start on the other windows box? If not you should check if the C++ runtimes are installed there.

  • Make sure the installer copy the dll's in proper folder settings, because your project works for me (on Xp without Qt)
    take a look here: !!
    LE: Looks like the folder imageformats should be directly in the same folder as the application, not in the plugins folder.

  • Maybe. Or you can qApp.addLibraryPath( qApp.applicationDirPath + QString("/plugins") ); and put them in plugins/imageformats.

    When I copied them manually to the app dir, it did not work under Vista x64. Not sure why.
    But this method works under Vista x64. Now for a Win 7 x64 test.

    Yep. Works fine on Win 7 x64 too.

    • windy

  • the plugins must be in a subdir plugins/imageformats - this is per default in the library search path, it should not be necessary to add it manually.

  • @Volker: i though the same, but the default behavior seem to be imageformats folder direct in the same folder as application (it doesn't work if i put them in the plugins/imageformats) //see the print-screen above - that's on a brand-new installation of Xp, i just built an Xp machine to test my apps, no Qt installed yet ;)

  • So I guess we agree that Nokia or TrollTech or whoever needs to update the docs to make this more clear. Seems that they have not covered all the bases re the Deployment of applications.
    Thanks for your help,

  • Oh yes, you're right Zlatomir. My fault, sorry. It is necessary to add the dir to the plugins path.

  • Windy, that's all explained in the "Deploying an Application on Windows": page of the docs, there's a dedicated section regarding the "Qt plugins": at the end.

  • have you tested your application with same compiled libraries in WindowsXP SP2? If you did, so it would be a Qt bug. You may report it.

Log in to reply