Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

windows - Qt 5.0 program runs in QtCreator but not outside

Here is the context:

  • I have developed a program with Qt under Windows 7 x64.
  • I have upgraded to Qt 5.0.1, QtCreator 2.6.1, Compiler VS2010.

Now the status:

  • My program runs fine in QtCreator but, when I tried it outside, I received several errors.
  • I checked this topic which gave me some answers: qtcreator - exe does work fine inside qtcreator but doesn't outside
  • I thus added Qt dlls and it helped, no more Missing Libraries messages.
  • Still, it would not run outside QtCreator (no more error message, I just doesn't run) so I added the platforms directory with both qminimal and qwindows dlls, it didn't help.
  • I also downloaded and added libEGL.dll as sugested, with no result.

I'm stuck and could really a little help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is a dependency problem that your program can not load its dependencies, copy dependency files (DLL files) to application directory is a temporary way, this is very risky way that your application may faced with problems in target machine, if target machine does not have correct version of Microsoft Runtime Library installed on them, your application can not run correctly, you can find which dependenices (DLL files) your application needs them with Dependency Walker.

There are two ways to solve this:

First one is to use Microsoft Visual C++ 2010 Runtime components in your installshield (or another versions depends on which version of Runtime library you compiled with it), that user could install it silently, or install with its executable binary without use installshield, and later copy DLL files to application directory and distribute it.

Second is use static compilation method to avoid such problems like that, but for static compile of your application you need a Commercial License if you want to distribute it on target machines.

For Deploy Your Application on target machines:

1) Put Microsoft Visual C++ 2010 Runtime Library in your application folder, so user will install it on their machine.

2) Copy application required dependencies (DLL files) from Qt's bin folder in your application folder (bin folder path:C:QtQt5.0.25.0.2msvc2010in).

3) Copy imageformats folder from your Qt's plugins folder in your application folder (if you use any image resource file in your application).

4) Copy platforms folder from your Qt's plugins folder in your application folder.

Qt's plugins folder path: C:QtQt5.0.25.0.2msvc2010plugins


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...