PDA

View Full Version : QT Creator DLL Question (Windows)



Sisco55
28th November 2009, 16:16
Note: Yes, I have seen other threads asking the same question. I haven't been able to find one that I can understand. I am a noob to Qt.

I need help. I have just recently began using QT, and I am using QT Creator as the ide (love it by the way). One problem that I have, is that programs created with QT require the QT Dlls, and even a simple application turns out huge because I would have to send the Dlls with the executable. This wouldn't be a problem, except that the dlls are HUGE. I made a simple little program that edits web pages, it shouldn't be over 200 megabytes...

I have looked on Google and in the documentation for a while now, and it seems that the solution most offered is to link Qt Creator to a "static library". I can't find any good information on how to do this, and don't know if this is even what I need to do.

Basically: I need to link the libraries so I don't have to distribute the program as a huge file loaded with dlls.

squidge
28th November 2009, 17:56
You need to recompile Qt so you have a static build, then you can link against this build rather than the default which uses DLLs.

Read the license first though - if you statically link, your program must be either open-source or you must purchase a license from Nokia.

If you distribute the DLLs instead, you don't need to purchase a license, and your program can be closed-source. This is the default. Its also better, as you only need one copy of the DLLs on any one machine, rather than every program statically linking to them and using up memory and disk space.

Sisco55
28th November 2009, 20:14
So how should I distribute the program? The folder with the dlls and executable is 100 megabytes. Should I just accept that and publish it like that or should I link it statically? The program will be under the GPL so that isn't an issue.

squidge
28th November 2009, 22:10
100MB seems quite large, which DLLs are you using and how big is your exe?

Typically I would distribute your program first in one archive, and then state something like "This application requires the Qt runtime libraries. You can download those seperately here if you don't have them already."

Coises
29th November 2009, 16:14
So how should I distribute the program? The folder with the dlls and executable is 100 megabytes. Should I just accept that and publish it like that or should I link it statically? The program will be under the GPL so that isn't an issue.

On the machine that doesn’t have Qt installed, move all the Qt DLLs out of the distribution folder. Attempt to run the program — you’ll get an error message naming a DLL. Move that DLL back into the folder, and try again. Repeat until you don’t get an error message.

You’ll probably find that you now have a running program without nearly so many DLLs.

wysota
29th November 2009, 16:50
I made a simple little program that edits web pages, it shouldn't be over 200 megabytes...

I'd assume you have linked to debug versions of the libraries. Release ones should be much (10 times?) smaller.

Sisco55
29th November 2009, 21:06
That was the problem, I linked to the debug libraries. :o

But now there is a new problem. When I try and run the program it says this:

http://img686.imageshack.us/img686/4907/problemp.th.png (http://img686.imageshack.us/i/problemp.png/)

Now what is wrong?

Thanks for the help by the way. :)

wysota
29th November 2009, 21:35
You have probably trying to use wrong libraries - the ones from Qt Creator instead of the ones your application was built against.

Sisco55
29th November 2009, 21:37
Edit: Nevermind. Fixed it myself. I using the wrong dlls. I was using the dlls from C:\Qt\2009.04\bin instead of the dlls from C:\Qt\2009.04\qt\bin


Thanks all for the help. You guys are awesome.