PDA

View Full Version : Qt 5.1 Application doesnt start in windows !!!



omid_kma
14th July 2013, 08:02
Hi
I release prject with Qt 5.1.0 for windows using Windows 32-bit (VS 2012, 511 MB) then I put necessary dll s Including plugin folder ( with this application (http://technet.microsoft.com/en-us/sysinternals/bb896656.aspx)
And then I run application in my own pc every thing works fine but when I tried other pc that doesn't contain Qt it doesn't start (no error just doesn't show any thing !...)
Things that I have done :
I installed visual c++ 2012-210-2008 Redistrutable packages
Putting all dll s even debug ones !
Putting plugins folder
9287
I tried dependency walker but it seems nothing is missing !!

Note that I have same probem with mingw version of Qt 5.1 too !
I tried using this qApp->setLibraryPath(dir);
Thenit runs but still cant play sound (doesn't recognize multimedia dll this one I think dsengine.dll !!)
I use QMediaPlayer and QSqlite in my application and I added all necessary dll s :(

Any help?

smemamian
14th July 2013, 08:31
hi everybody

I have same problem too, plz help :(

omid_kma
15th July 2013, 05:39
Any help?!

rawfool
15th July 2013, 08:52
Did you create a folder called platforms inside your application directory and add qwindows.dll into that folder?

omid_kma
16th July 2013, 07:56
Did you create a folder called platforms inside your application directory and add qwindows.dll into that folder?
Yes I do see the picture I attached...

alizadeh91
16th July 2013, 08:50
copy all of contents of plugins folder into your app to see if works. Did you used qml module in your app? Did you used third party libs in your app?

If you used qml, then you have to copy contents of qml folder into your app folder.

omid_kma
16th July 2013, 09:12
copy all of contents of plugins folder into your app to see if works.
As I said,I tried it before.

Did you used qml module in your app? Did you used third party libs in your app?
No . I didn't use qml too.

alizadeh91
16th July 2013, 09:33
You said that the sound is not playing and the app has launched. so the problem is not triggered by dll and i think it has to be the path. are u sure about path of your sound files? ( have u added it into your resources or gave it an absolute path?)

omid_kma
16th July 2013, 11:16
You said that the sound is not playing and the app has launched. so the problem is not triggered by dll and i think it has to be the path. are u sure about path of your sound files? ( have u added it into your resources or gave it an absolute path?)
QMediaPlayer cant play sound from resource and yes I give it absoulutePath base on QApplication::applicationDirPath() so it is not the problem!
And No it doesnt start unless I put this line of codes in main (I must put application in c:/Setup in this way !)

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{

qApp->setLibraryPaths(QStringList()<<"C:/Setup"<<"C:/Setup/plugins");

QApplication a(argc, argv);

MainWindow w;
w.show();

return a.exec();
}


Added after 22 minutes:

I tried fllowing code and now every thing seems to work in other pc's except the music part(It doesnt use dsengine from plugin floder *I put the whole plugin folder in my application folder *!!!see this image !9297 ) Maybe a bug in Qt?!

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QStringList split=QString(argv[0]).split("\\");
split.removeAt(split.size()-1);
QString path=split.join("\\");

qApp->setLibraryPaths(QStringList()<<path<<path+"\\plugins"<<path+"\\plugins\\mediaservice");//path+"\\plugins\\mediaservice" because dsengine.dll is located in mediaservice folder I tried with out it too!!

QApplication a(argc, argv);

MainWindow w;
w.show();

return a.exec();
}

omid_kma
16th July 2013, 14:55
Muhaha ;) I fixed the problem !!!!!!
The problem was that I used QMediaPlayer in static way ! (still seems a bug to me !)
And now with using setLibraryPath everything works fine in other pc's :D
Can any one explain me why this problem happens when I use QMediaPlayer in a static class?

*Edit*
It Works with out qApp()->setLibraryPaths() too :)

ChrisW67
16th July 2013, 21:57
If you were using a static Qt build (you would have had to build this yourself from source) then you lose the ability to load plugins at runtime. If you did not also build the necessary multimedia plugins into your executable then they were not available and nothing requiring the missing plugins would work.

Of course, if you had actually built a static Qt then all this talk of deploying the correct DLLs is moot as they were not required. Simlarly, Dependency Walker would be happy because there are no Qt DLLs required: it does not identify plugins loaded unless you run a dynamically-linked program in profile mode.

A dynamic program deployed in accordance with the docs does not require calls to setLibraryPath().

@semamiam: you do not have exactly the same problem (although you appear to be doing exactly the same assignment) so I suggest you work your problem in the thread you started and then abandoned.

omid_kma
17th July 2013, 06:09
Nopes you miss understand me I ment this as static QMediaPlayer (not static build) :)

class test
{
static QMediaPlayer* player;
}
QMediaPlayer* test::player=new QMediaPlayer();

If you use this class then the program would not recognize plugins dll !
.
.
.

ChrisW67
17th July 2013, 22:47
Creating the object in the way you do above happens before main() and therefore before the application object comes into being. Chances are (I have not verified this) that QMediaPlayer requires the setup done by QCoreApplication.

lettehwriterswrite
6th May 2017, 08:33
copy all of contents of plugins folder into your app to see if works. Did you used qml module in your app? Did you used third party libs in your app?

If you used qml, then you have to copy contents of qml folder into your app folder.

I signed up just to thank you. You saved me. Qt can be such a nightmare! I spent hours trying to figure out why my app would launch but no GUI popped up. That was it. I use the windeployqt tool and it doesn't import the qml folder for you. Ugh what a horrid nightmare. Missed my project deadline because of it.
Thank you.