Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error: could not find or load the Qt platform plugin “windows”

Error: could not find or load the Qt platform plugin “windows”

Scheduled Pinned Locked Moved General and Desktop
14 Posts 5 Posters 4.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pixaeiro
    wrote on last edited by
    #4

    Thanks SGaist,
    Here is a snapshot of my deployment dir:
    !http://i.imgur.com/rjVD5Gu.png(deployment dir)!

    pixaeiro
    http://www.pixaflux.com
    Parametric Image Compositing

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #5

      Shouldn't the plugin folders be located in a plugins directory? Have you tried running windeployqt?

      (Z(:^

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pixaeiro
        wrote on last edited by
        #6

        Thanks sierdzio!
        I copied the plugins directory and its contents to the deployment directory, but that didn't work.
        What is the purpose of windeployqt? Should I run this on my user's machine?

        pixaeiro
        http://www.pixaflux.com
        Parametric Image Compositing

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pixaeiro
          wrote on last edited by
          #7

          Thanks Chris,

          When I changed the QTDIR and PATH environment variables I was expecting to get the same error messages on machine, but I am not, that's what makes me think that somehow these paths are hardcoded in my Qt dll files.

          And I do have to change the QTDIR very often to switch from Qt 4.7.1 and Qt 5.3.2. (not as much now that everything is installed).

          pixaeiro
          http://www.pixaflux.com
          Parametric Image Compositing

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pixaeiro
            wrote on last edited by
            #8

            I copied the entire directory:
            c:\Qt\5.3.2\vs2013_64bits\qtbase\plugins
            To my user's machine c: drive, and now I can execute my application in that machine.
            This tells me that somehow the path c:\Qt\5.3.2\vs2013_64bits is coded in my application or the Qt dll files.
            Is there any way to tell Qt where to look for these plugins?
            Thank you again!

            pixaeiro
            http://www.pixaflux.com
            Parametric Image Compositing

            1 Reply Last reply
            0
            • hskoglundH Offline
              hskoglundH Offline
              hskoglund
              wrote on last edited by
              #9

              Hi, I had same problem as you, and decided to learn more about Qt and its plugins. Turns out there are in total 7 (!) different ways you can tell Qt where to look for the plugins, I've written about it "here":http://www.tripleboot.org/?p=536#PluginDLLs

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pixaeiro
                wrote on last edited by
                #10

                Thank you very much hskoglund!

                Your guide seems very complete... I'll study it carefully.

                I also found this:
                https://qt-project.org/doc/qt-5-snapshot/deployment-plugins.html

                And when I look to the QLibraryInfo::PluginsPath in the debugger it is:

                C:/Qt/5.3.2/vs2013_64bits/qtbase/plugins

                Which apparently is set when the library is built or using qt.conf.

                Thank you again!

                pixaeiro
                http://www.pixaflux.com
                Parametric Image Compositing

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pixaeiro
                  wrote on last edited by
                  #11

                  According to this guide:

                  https://qt-project.org/doc/qt-5-snapshot/deployment-plugins.html

                  You can set the plugin path using QCoreApplication::addLibraryPath.

                  I tried to assemble the plugins path using QCoreApplication::applicationDirPath(), but this method requires that an instance of QApplication has been initialized, which fails because of no plugins!

                  The only way I found to set the path was using argv[ 0 ] and boost:

                  @
                  boost::filesystem::path exe_path = boost::filesystem::system_complete( boost::filesystem::path( argv[0] ) );
                  boost::filesystem::path dir_path = exe_path.parent_path();

                  QString plugin_path( dir_path.string().c_str() );
                  plugin_path = plugin_path + "/qt_plugins";
                  plugin_path.replace( "\", "/" );

                  QCoreApplication::addLibraryPath( plugin_path );
                  @

                  This works but the argv[ 0 ] makes it iffy.

                  pixaeiro
                  http://www.pixaflux.com
                  Parametric Image Compositing

                  1 Reply Last reply
                  0
                  • hskoglundH Offline
                    hskoglundH Offline
                    hskoglund
                    wrote on last edited by
                    #12

                    Hi, if you just want to tell Qt to look for the plugins in a subdirectory below your .exe file, you can use a relative path syntax (i.e. no C: or slashes):
                    !http://tripleboot.org/Qt/AddLibrary.png(addLibraryPath example)!

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pixaeiro
                      wrote on last edited by
                      #13

                      Hi hskoglund!
                      Yes, using a relative path was the first thing I tried, but it didn't work.

                      pixaeiro
                      http://www.pixaflux.com
                      Parametric Image Compositing

                      1 Reply Last reply
                      0
                      • hskoglundH Offline
                        hskoglundH Offline
                        hskoglund
                        wrote on last edited by
                        #14

                        Hmm just tried it, maybe my testapp is too simple. Anyways, there are other alternatives to tell Qt about that path, you could try creating a qt.conf file and place it together with your .exe file, and stuff it with these 2 lines:
                        @
                        [Paths]
                        Plugins=qt_plugins
                        @

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved