0

I have a Qt project. I can build it but I have to keep all external files near with the executable one if I want to use the exe-file as portable program. But a customer wants it to be an one executable without any other files. The size of result file does not matter.

So, if I would use Python, I could do it like this:

[localhost@localhost ~]$ pyinstaller --onefile myscript.py

Can I do the same using Qt (with MinGW)?

Bogdan
  • 558
  • 2
  • 8
  • 22

3 Answers3

1

It depends on the files you are talking about. With static linking you can get rid of dll files and by using Qt resource collection files you can for example link pictures and html files into your executable.

Benjamin Bihler
  • 1,612
  • 11
  • 32
  • 1
    Note that Qt is licensed under the LGPL, so statically linking to it 'infects' your project. Probably not a problem for an in-house tool, but something to keep in mind. – Botje Dec 07 '18 at 14:02
  • Remember that you need a commercial license for Qt to distribute statically linked Qt libraries in your executables. – Michael Surette Dec 07 '18 at 14:05
0

You could package your bundle into a self-extracting ZIP that automatically runs and cleans up after itself. I found this answer that gets you close.

Botje
  • 26,269
  • 3
  • 31
  • 41
0

You can't unless you have a commercial Qt license or if you don't link to any of the Qt libraries (you could still use Qt creator and qmake).