QT Programming - qt Creator problem

I just trying the basics of qt progreamming and I have some problems.
1. When I build project in debug mode it is ok and i can run app in qt creator and outside if i have enviorment variable declareded.
2. I cant run release version of program.
3. I wanna know how to make this exe standalone
Thank you
QT applications are shiped with QT DLL's if a program is linked dinamicaly.

Instead you can link your program with lib's but the exe will be much larger then.
I read that qt can also be built statically.
any idea how can i do that, I already search on net but i cant find good answer. Can anyone tell me how build things statically?
And also explain difference betwen (dynamically and statically building).
*I m using mingw with qt creator
Dinamicaly linking an application means that you're are going to ship your application with required DLL's, while staticaly linking an application means that you'll ship your application as a standalone exe that does not requre any aditional files to be able to run.

Dinamicaly also means that funcitons or whatever is in the DLL file will be "called" during execution of a program. (DLL is going to be loaded into memory before execution)

Staticaly linked program allready has all that functions or whatever is in the lib file build into exe it self. (thats why exe becomes much larger).

"Dinamicaly" requires *.DLL files
"Staticaly" requires *.lib files

How to build you program staticaly?

In order to do that you set up your development enviroinment (IDE) and libraries (build QT libraries) in a such way that all the future projects "bind" ether to *.lib's or DLL'S or both! (or you manualy switch between them)

QT creator is linking dinamicaly by default, You'll have to check only 1 thing before proceeding into building QT libraries (which takes some time)

Go to install directory of QT creator (it's QTDIR\lib) and check whether there are QT *.lib files like GUI.lib, QT.lib and similar. If you found them that that's it, all you have to do is to setup you project so that is links to these libraries and NOT to dll's like QT.dll or GUI.dll (you'll find these too in QTDIR\?)

I can't say exactly how to do that in QT Creator since I'm using QT libraries with visual studio.

If you don't find any lib files inside QTDIR you'll have to build them from the source, and here is a reference on howto do that:
http://www.formortals.com/how-to-statically-link-qt-4/

Note that you'll have to spend some time learing various things about building libraries, as you don't want to spend 10 houres compiling and then figure out that you missed a multithreaded switch or whatever :D

Just read the article from the link abowe.
Hope this helps.

EDIT:
Here are some switches to build staticaly:
http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/
Last edited on
thanks it works finally
Topic archived. No new replies allowed.