This application failed to start because no Qt platform plugin could be initialized!



  • i extract qt 5.12.0 src to two dirs (debug release), the debug dir is to build debug library, relesase dir is to build release library, when i complie success, i nmake install debug dir's library to dir A,then nmake install release dir's library to dir A, finally i copy the dir A to ohter machine.
    i create a project by qtcreator and complie it with Qt build by myself, when i run it by qt creator, it will crash in debug mode:
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    release is ok!

    qt.conf

    [Paths]
    Prefix=..

    debug lib configue params:
    configure -confirm-license -opensource -platform win32-msvc -debug -shared -force-debug-info -angle -opengl dynamic -prefix "E:\Library\Qt5.12.0_VS2017_VCLTL" -qt-sqlite -qt-pcre -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -ssl -openssl-linked -nomake tests -no-compile-examples -nomake examples -nomake tools -IE:\Library\OpenSSL\include -LE:\Library\OpenSSL\libd



  • @JohnDaYe

    You do not have to split Qt source into a debug and a release folder for compilation. The standard is that both are compiled in one configure and make run at once. In creator you can select either debug or release with the same qmake.

    In your case you would need two different qmake. Each qmake defines what is called a different tool chain. With one tool chain you can compile and debug. When you like to have a release version of your application you need to change the tool.



  • @koahnig
    can i copy The standard's toolchain exe replace my build version?

    i must split my qt souce to debug and release because VC-LTL



  • @JohnDaYe said in This application failed to start because no Qt platform plugin could be initialized!:

    @koahnig
    can i copy The standard's toolchain exe replace my build version?

    The compiled qmake.exe and the built Qt libs are somewhat one unit. The generated qmake holds some important information of the configuration and setup. AFAIK you cannot copy them over to another tool chain.

    i must split my qt souce to debug and release because VC-LTL

    Do not know anything about this. However, this sounds strange to me.



  • @koahnig
    i can build my test project with my build version, only the problem is i can not run it by qt creator or Visual studio, but i can use windeployqt to copy dll to my project build path, i works fine
    if i build my test project with standard ver , i it is not need to copy dll when i run it by vs or qt creator



  • @koahnig wait for me, i can resolve it! i will post my method, wait 4 me



  • @koahnig
    i do a test
    i copy a standard ver install by offical installer from dir A to dir B, i build my test project with B, i can run my exe by qt creator,but i rename dia A to C, i build my test project with B, it can't run by qt creator!

    so i think installer will do something what i do not know!



  • Sure, the Qt installer "burns" the path to dir A into Qt5Core.dll, for example if I open my Qt5Core.dll I can see
    qt_prfxpath=C:\Qt\5.12.0\msvc2017 inside it.

    If that qt_prfxpath is pointing to a non-existent directory then you will get that platform plugin error. One way out of this problem is to run windeployqt on your .exe file, when it copies the necessary Qt .dll files it will also neuter that path (i.e. that copy will read): qt_prfxpath=.

    This will instead make Qt look for the platforms subdirectory in the same place as the .exe file.



  • @hskoglund thanks
    i can change it in qt5cored.dll by winhex or make a tool to do this
    only debug dll need do this



  • @JohnDaYe

    Certainly a way to change the name.

    However, IMHO you will spend a couple of month until you get the stuff to work. There has been a Qt tool in the far past that allowed changing the location of Qt libs afterwards. Haven't read of it for long. Might have been even Qt4.
    The online installer makes things mauch easier.

    IMHO you shold check if you really have to separate in debug and release folders for Qt.

    Why are you refering directly to VCLTL when configuring Qt?
    Libraries shall be independent enough or at least Qt libs shall be the basis to be used when the other lib is compiled.
    When VCLTL requires the other way around you should check there for help.



  • @koahnig
    VCLTL can let my qt program run with out VC run time
    VC Runtime is terrible now!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.