Setting Up Integrated Development Environment
To compile Qt Programs, you need Qt Development Environment. You need to Download Qt Creator or Qt Windows OpenSource MinGW or VC++. Qt Creator is easy for beginners to use. It doesn't need or needs very less configuration.
If you use Qt OpenSource, in Windows, Qt Command Prompt will be present in Start Menu. The required Environment and Path will be automatically setup in the Command Prompt.
Compiling and executing Qt program Using Qt Prompt
1. Create a directory with your name of your project
2. Copy paste the above program as main.cpp in the directory
3. In the directory run
a. qmake -project. This creates the Project file .pro with name as the directory name b. qmake. This creates makefiles for both debug and release versions. c. make/gmake/nmake - as needed by OS and your compiler setups. You should give 'make/gmake/nmake release' if you need release versions of your program
4. Execute ./release/Program (Or release\Program.exe in Windows)
To Execute Programs in Windows, you need to copy a few DLLs to the working Directory. If it is debug version, navigate to bin Directory of your Qt Installed Directory and copy QtCore[x]d.dll, QtGui[x]d.dll, mingwm[y].dll, libstdc++-[y].dll. You may need other DLLs too. Copy to the Directory where the exe file is. When you execute, if it displays any missing DLL file, copy them from Qt/Bin Directory. Here 'x' represents the Qt Version and 'y' represents MinGW version. If you are going to execute release version, copy DLLs without the suffix 'd'. Note that if you are going to give the executables to others, you need to give them the DLL files too.Last modified on 9 March 2013, at 20:43