PDA

View Full Version : executable version



danilodsp
21st September 2011, 23:37
Hello friends,

normally I copy the libraries .dll for the folder together with the executable. And it always worked.
However, I did a software for image processing, that use the QPixmap, QImage, math.h, libraries among others. And it not working.
I copied the libraries .dll that are necessary for run without error, the software opens without error, but the image not open. And when I compile the code, he run and open the image without problem.

How will I find the libraries are needed?

Sorry my english.

ChrisW67
22nd September 2011, 00:35
You probably need to deploy the Qt image format plugin(s) into the "imageformats" sub-directory.
See one of the many times this has come up

Lesiok
22nd September 2011, 07:57
Read about deploying Qt application (http://doc.qt.nokia.com/latest/deployment.html)

danilodsp
23rd September 2011, 15:01
I read about Deploying Qt Applications and realized that I want to do static linking.
I read in the link of Chris, my software also has load jpge, and QPainter.
I used:

QApplication a(argc, argv);
a.addLibraryPath("C:/QtSDK/Desktop/Qt/4.7.4/mingw/plugins");
PDI w;
w.show();
return a.exec();

But not working.
I do not understand what is really needed, I thought all the linking .dll was already done automatically by Qt.
It seems complicated.

ChrisW67
24th September 2011, 00:20
If you were:

normally I copy the libraries .dll for the folder together with the executable. And it always worked.
then you have been using dynamic linking. If you are finding that images are not loading then you just need to copy another DLL or two to supply the image plugins. No code changes. It hasn't changed in difficulty at all.


C:\Program Files\My Funky Program
- program.exe
- QtCore4.dll
- QtGui4.dll
- ...
+ imageformats
- qjpeg4.dll
- jgif4.dll
- ...
+ sqldrivers
- qsqlite4.dll



If you want to do static linking then you need to:

Build Qt for static linking (i.e. the -static configure option)
Modify your application to arrange static inclusion of the same image format plugins How To
Build your application
Deploy your application keeping an eye on your license requirements regarding source/relinking ability if your are using GPL/LGPL.

danilodsp
3rd October 2011, 20:17
Hi friend,

I understand.
Actually I want the dynamic linking. I kept copying and did not work, I thought I was doing something wrong or different than before, then searched but not found the problem.
I copied everything of: (more than 60 .dll)
C:\QtSDK\Desktop\Qt\4.7.4\mingw\plugins
for my executable.

When it did not work, I copied other .dll of other directories did not work.
Sorry being boring, but I really do not know what's wrong.

ChrisW67
4th October 2011, 00:37
On the deployed machine:

Open a command prompt
Change directory to the application install directory
Execute "DIR /s /b"
Copy and paste the output here

danilodsp
4th October 2011, 14:34
follow:


C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug>DIR /s /b

C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\dialogmedia.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libgcc_s_dw2-1.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqcncodecs4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqcncodecsd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqgif4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqgifd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqglgraphicssystem4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqglgraphicssystemd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqico4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqicod4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqjpcodecs4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqjpcodecsd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqjpeg4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqjpegd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqkrcodecs4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqkrcodecsd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqmng4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqmngd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqsvg4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqsvgd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqsvgicon4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqsvgicond4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqtiff4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqtiffd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqtracegraphicssystem4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqtracegraphicssystemd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqtwcodecs4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\libqtwcodecsd4.a
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\main.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\mediaimg.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\mingwm10.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_dialogmedia.cpp
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_dialogmedia.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_mediaimg.cpp
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_mediaimg.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_pdi.cpp
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_pdi.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_sobre.cpp
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_sobre.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_vishist.cpp
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\moc_vishist.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\PDI.exe
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\pdi.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qcncodecs4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qcncodecsd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qgif4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qgifd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qglgraphicssystem4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qglgraphicssystemd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qico4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qicod4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qjpcodecs4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qjpcodecsd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qjpeg4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qjpegd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qkrcodecs4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qkrcodecsd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qmng4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qmngd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qrc_img.cpp
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qrc_img.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qsvg4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qsvgd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qsvgicon4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qsvgicond4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\QtCored4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\QtGuid4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qtiff4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qtiffd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qtracegraphicssystem4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qtracegraphicssystemd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qtwcodecs4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\qtwcodecsd4.dll
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\sobre.o
C:\Users\Danilo\Documents\Processamento de imagens\PDI-build-desktop\debug\vishist.o

Before, I had placed .dll's the most, unnecessary.

Added after 8 minutes:

When I do debug with Qt Creator then the program works, it loads the image (.jpg) on the label. But when I put the .dll in debug folder then the image does not load anymore.
Even through the Qt Creator, then I delete the folder and do debug by Qt Creator to work.

6935

danilodsp
4th October 2011, 19:56
I'm discovering something.
I put my .exe in the folder:C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin
and it worked.
It seems that there's something I need, I'll try to find out.

Added after 14 minutes:

YES!
It's working.
Thank you guys, I was copying some .dll (as mingwm10, libgcc_s_dw2-1, QtCored4 and QtGuid4) of other different folder. But it has to be all of:
C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin
I found through of a post by Chris.
Thank you.

Note: does not need plugins imageformats to work.

ChrisW67
5th October 2011, 01:36
You were not putting the various plugins in the correct folder with respect to the program executable anyway.

danilodsp
5th October 2011, 15:28
But now I have one problem.
The program alone is working in my computer. For other computer, I have that copy all the .dll of the new computer. :(
And not is working in computer without Qt.

ChrisW67
5th October 2011, 23:22
But now I have one problem.
The program alone is working in my computer. For other computer, I have that copy all the .dll of the new computer.
And not is working in computer without Qt.

I have taken my toy train locomotive to my friend's place but I didn't bring the track. Why doesn't my train go?

Of course you need the Qt runtime libraries and plugins your application uses on the computer that you want to run your dynamically linked Qt application on. All the information you need is in this thread.

danilodsp
5th October 2011, 23:33
Can I separate everything they need (to work on a computer without Qt) along with my executable?

ChrisW67
7th October 2011, 00:18
Deploying an Application on Windows
You are dynamic linking. You need:

Your application and any DLL components that you have built
Any Qt DLL your application needs (at least QtCore4.dll, probably QtGui4.dll and others)
Any Qt plugins your application needs to support image formats, icon formats, database connections etc.
Any DLL required for your C++ compiler run time


You need to adhere to the terms of the license under which you are using Qt and the LGPL for the components only licensed under those terms.

danilodsp
7th October 2011, 11:15
Ok.
Thank you.

About:
"Any Qt plugins your application needs to support image formats, icon formats, database connections etc."

just add .dll of imageformats, icon formats, and other ... ?

ChrisW67
7th October 2011, 22:59
Yes, but they need to be in subdirectories, e.g. as in my earlier post (http://www.qtcentre.org/threads/44761-executable-version?p=203930#post203930)

danilodsp
8th October 2011, 13:51
yeah,

I finally got it.
It is running on any computer. :D
Thank you Chris.

I was not copying the subdirectories.