hacer un ejecutable independiente de qt

I have made an QT programm that I want to be able to run on another computer that doesnt have QTsdk installed on it. So I guess I have to make an executable file. Unfortunately I have abolutely no experience with this. Can somebody tell me how to do this in simple words?

I work have made the programm in Qt Creator 2.4.1 based on Qt 4.7.4 (32 bit) on a windows 64bit computer.

preguntado el 28 de agosto de 12 a las 11:08

"So I guess I have to make an executable file" Surely you have a running program already? -

Yes I do, but to show the program I just hit the "run" button in QT without actually knowing what this really does... -

It runs the application, the only difference between what hitting "Run" in Qt does and clicking on it in Windows, is that the program output is piped into Qt's console. -

The executable is in the build folder (found in the project's configuration in QtCreator), and there in one of the subfolders "debug" or "release". You also find the executable's path when hitting "run" in the output console within QtCreator (the blue line). -

Ah, this clears up a lot for me. Thx! So if I understand it right the program is compiled every time I hit the "run" button? Just wondering now what the difference is between letting it compile in the "debug" or "release" mode, but my primary question is awnsered :). -

3 Respuestas

On answer mentions statically linking your executable with the Qt libraries, this is very convenient as it means you only have a single file to deal with (your exe) - BUT because of Qt's licensing, it also means you have to buy a commercial license for your application.

Assuming you are not modifying Qt's source code, the way round this is to ship Qt's runtime libraries (the .dll files it needs for runtime linking) with your application. This is how the vast majority of programs on your machine work anyway because it has lots of other advantages too.

Respondido 28 ago 12, 11:08

I dont have a commercial licence so I would like to try the second option you mention. I have found lots of info with commands as qmake, mingw32 etc but they all say something different and nothings has worked so far. Can you clearly state which steps I have to do? - Frank

Por defecto qmake dynamically links, so you are already compiling for that. So all you have to do put the Qt dll files you need (at least QtCore, and almost certainly QtGui, but only you know exactly what features you need), in a place that your target Windows machine can find them. That's usually in the same folder you intend on putting the executable, but I'm not much of a Windows user so there may be somewhere more appropriate - hopefully I've given you enough info to do some web searching to find the extra details you need. Good luck! - cmannett85

Utilice las Caminante de dependencia to find out what Qt and other runtime (MinGW) DLLs are required in your app. Copy those DLLs to the same folder as your app. Zip the folder and distribute the archive.

Respondido 28 ago 12, 13:08

what do you mean with "app" in this case? If you mean an exe of the program I made, then I must ask you how I get this. - Frank

Yes, it's exe in Windows land. App used to be the short hand for application (built binaries) until smart phones came along... Dependency Walker is linked in my answer. - Esteban Chu

if you mean statical linking
http://doc.qt.nokia.com/4.7-snapshot/deployment.html#static-vs-shared-libraries

then there are tons of tutorials on the web
http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows
http://www.formortals.com/how-to-statically-link-qt-4/

it's just about configuring your qmake file with static flags.

Respondido 28 ago 12, 11:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.