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. Qt5.0 "Failed to load platform plugin"
Forum Updated to NodeBB v4.3 + New Features

Qt5.0 "Failed to load platform plugin"

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 6.0k Views 1 Watching
  • 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.
  • G Offline
    G Offline
    Geometrian
    wrote on last edited by
    #1

    Hi,

    I can build Qt 5.0 from source, configure-d using the arguments:
    -debug-and-release -shared -opensource -confirm-license -platform win32-msvc2010 -nomake tests -nomake examples -nomake demos -nomake tools -opengl desktop

    When running the program, I get a Debug Error, which says, in part:
    Failed to load platform plugin "windows". Available platforms are:

    . . . and then none are listed. I'm guessing it's a flag I didn't include in configure?

    Thanks,

    1 Reply Last reply
    0
    • S Offline
      S Offline
      soroush
      wrote on last edited by
      #2

      No need to reconfigure nor compile. Your application is confused about loading plugins. Put platform folder beside your executable:
      "http://qt-project.org/forums/viewthread/23367/":http://qt-project.org/forums/viewthread/23367/

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Geometrian
        wrote on last edited by
        #3

        I copied the platforms directory onto a place where PATH could find it, but the error persists. The directory contains "qwindows.dll" and "qwindowsd.dll", among other things.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          soroush
          wrote on last edited by
          #4

          [quote author="Geometrian" date="1357589219"]I copied the platforms directory onto a place where PATH could find it, but the error persists. The directory contains "qwindows.dll" and "qwindowsd.dll", among other things.[/quote]

          You are doing exactly my mistakes! Take a look at above link. You need to copy that directory beside your executable. Not somewhere visible in PATH scope. Plugins are loaded dynamically at runtime by program not by OS at load time. Application will look at locations hard-coded in QtCore and QT_PLUGIN_PATH env variable. (Second way not recommended by Windowsian guys of this forum ;)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Geometrian
            wrote on last edited by
            #5

            [quote]You need to copy that directory beside your executable.[/quote]Ah, reading the thread a bit more carefully, one can figure out that.

            But this is such a nasty solution! First there's like twenty DLLs. I don't like it, but I can live with that since they're on PATH, but a hardcoded directory at the application's root level? No. Not acceptable. Is there another way in Qt 5?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              soroush
              wrote on last edited by
              #6

              You won't need all of them. Yes there is another way. Put all plugins in somewhere and set QT_PLUGIN_PATH environment variable to point to that location. That's what I'm doing now. Though It's not recommended because can cause applications with different versions of Qt libs to failure.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Geometrian
                wrote on last edited by
                #7

                [quote]You won’t need all of them.[/quote]I count five for debug, five for release, that are actually needed. Still excessive.[quote]Yes there is another way. Put all plugins in somewhere and set QT_PLUGIN_PATH environment variable to point to that location. That’s what I’m doing now. Though It’s not recommended because can cause applications with different versions of Qt libs to failure.[/quote]Hmmm, better, but still horrible. Maybe it's possible for the application to set the variable itself on runtime? Are you sure there's not a better way?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  soroush
                  wrote on last edited by
                  #8

                  I think QCoreApplication::addLibraryPath will do so.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    Geometrian
                    wrote on last edited by
                    #9

                    Immediately after creating the program, I added an absolute path to the directory (I tried both the directory itself and its parent directory. Doesn't seem to fix it.

                    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