Qt Creator Download and install (detailed tutorial)

Source: Internet
Author: User

Brief introduction

QT is a cross-platform graphics Development Library, currently operated by QT Company, a wholly-owned subsidiary of Digia, official website:
http://www.qt.io/
You can also access the QT Project domain name: http://qt-project.org/
QT itself supports many operating systems. From general operating system Linux, Windows, to mobile phone system Android, IOS, Winphone, embedded systems support QNX, VxWorks, and are widely used.
QT-based software is very numerous, the most well-known is the Linux desktop system KDE (covering countless applications with K). The domestic WPS for Linux version, and for Linux, is also an interface developed using the QT library. QT is easy to learn as long as there is a C + + foundation, and it's easy to develop cross-platform programs. The current mainstream QT library has QT4 and Qt5 two large versions, which are described below for download and installation in Windows systems.

I. QT4 development environment Download and install

First go to the download page http://www.qt.io/download/
Click Options as prompted.


Finally click on the "Get started" button to enter the Open source page:
http://www.qt.io/download-open-source/

Above the big button download now is the download online installation version, actually just a download tool, not the real QT Development library. You can download the offline installation package yourself, note the "View All Downloads" page, and you can see the offline package when you click on it. What is the Qt4 of the Qt5.4.0 version of the current view?
Drag the page above to the bottom:

The old version package is the last link: http://download.qt.io/archive/

You can see four directories open after: Vsaddin is the VisualStudio integration plug-in, Qtcreator is the official QT integrated development environment, QT is a variety of new and old versions of the download location, Online_installers is the online installation tool.
In Qt4, the QT development environment consists of 3 basic parts: the QT Framework (QT library), the Qtcreator (IDE), and the MinGW (compilation debugging) are downloaded and installed and configured separately. After entering the QT5, QT company packaged the three into an installation file, such as Qt5.4.0 's offline installation package, so much more convenient. Here we first talk about the development environment of the old QT 4.8.6 Download the installation configuration method.

1. Qt 4.8.6 Download

Go to the catalog from the page just now
http://download.qt.io/archive/qt/4.8/4.8.6/
The first two are VS2010 and VS2008 compiled QT Library, the third is the MinGW version of the QT Library, is to download MinGW version to use. The two at the end of DMG are the QT libraries used in the MacOS system, qt-everywhere-opensource-src-4.8.6 is the QT source package, there are zip and tar.gz two compression format, two content is the same, just zip generally under Windows more popular, tar.gz is the popular compression format on Linux. md5sums-4.8.6 is the checksum of the above file, and changes-4.8.6 is the QT version log file.
Download Qt-opensource-windows-x86-mingw482-4.8.6-1.exe:
Http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-mingw482-4.8.6-1.exe
Do not rush to install after the download, there are other needs to download.

2, Qtcreator download

In the http://download.qt.io/archive/qtcreator/page there are some old version of Qtcreator can be downloaded, but there is a new version or newer version of the better.
Go to the http://www.qt.io/download-open-source/and click "View all Downloads" to find

This is very clear, the Qt5.4.0 installation package has been qtcreator, if it is loaded Qt5.4.0 do not need to download. We loaded 4.8.6, here to download "Qt Creator 3.3.0 for Windows (MB)",  
Click to download. Let's take a closer look at the download link:  
http://mirrors.hust.edu.cn/qtproject/official_releases/qtcreator/3.3/3.3.0/ qt-creator-opensource-windows-x86-3.3.0.exe 
This utility is a domestic china dayang software image, we can try to enter:  
/http// mirrors.hust.edu.cn/qtproject/official_releases/ 
This is the same as the official QT software source, you can see  

Under the software must not be limited to a file link above, open the download link upper directory can find a bunch of good things. Open each subdirectory yourself see:  
①gdb is a debugger developed for Android.  
②jom can Baidu a bit, http://qt-project.org/wiki/jom , is NMAKE clone version, support multiple independent command parallel building software, speed up the software construction.  
③online_installers is an online installer.  
④pyside is used to support the Python language for writing QT programs.  
⑤qbs is QT build Suite (QBS), Http://qt-project.org/wiki/qbs,QBS is the new QT program Generation tool, because QT generally uses qmake to build the project to compile, Qmake must change based on QT version changes, not easy to manage, QT developers love and hate qmake, so create a non-dependent QT version of the build tool QBs.  
⑥qt, of course, is the QT library itself, from 4.8 to 5.4.  
⑦qt-installer-framework, Baidu is what, http://blog.csdn.net/cnsword/article/details/8740393, is dedicated to release the development of Good program , the generator installer allows you to build installers for Linux, Windows, MacOS. Qt's own qtcreator, QTSDK and other installers are packaged using Qt-installer-framework.  
⑧qtcreator is an integrated development environment, from 2.5 to 3.3 versions. &NBSP,
⑨vsaddin, is a QT development plugin for VisualStudio.

Why do I have to say so much, seemingly irrelevant things?
Now many WA brains are taught to die, teach stupid, download files also do not look at links, see links also whether there are other resources can be downloaded to use. When used to ask: the old version of Qt 4 where to download? Homepage how only Qt5.4.0, where to find Qt5.3.1?
These are low-level problems that don't have brains. can be downloaded to QT 5.4.0 version, with the bottom to think about, q.5.3.1 and Qt 4.8.6 can be how far?
A lot of resources are put in one piece, the intention to see the download link to the parent directory, search on the out.
Please remember: Download the file must not be limited, learn something must have the sense of exploration and discovery!

In addition to QT software image in addition to China Dayang, other domestic institutions are also some, the source of China's hkust is also faster: http://mirrors.ustc.edu.cn/qtproject/

3, MinGW 4.8.2

Why the 4.8.2? The mingw482 inside of the qt-opensource-windows-x86-mingw482-4.8.6-1.exe that we downloaded means that this QT library was built using MinGW inside g++ 4.8.2 Build, So the same version of MinGW is needed to compile the program to avoid problems such as compatibility with other old and new versions.
When we try to run Qt-opensource-windows-x86-mingw482-4.8.6-1.exe (don't install it, just look at it), the installer will be prompted where to find the MinGW version, and this mingw is not the official original:

is a private custom version, downloaded on SourceForge:
Http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds /4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download
Download links long, go to sourceforge browse the directory to see:
Http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds /4.8.2/threads-posix/dwarf/

The most downloaded is the QT installation package is indicated in the file link, of course, there are updated revisions, you can download ***rev3.7z can also download * * * rev4.7z, download the new rev4:i686-4.8.2-release-posix-dwarf-rt_v3-rev4.7z here

4. Installation

There are three files, the order is this, the QT library needs MinGW, and qtcreator need to configure the previous two, so first install MinGW, Install the qt-opensource-windows-x86-mingw482-4.8.6-1 again, and finally mount the Qtcreator.

(1) MinGW installation

This is the green version, the direct decompression to the C packing directory on the line, put to other partitions is also possible. As long as you specify the correct location on the line, here after the decompression path is: c:\mingw32,g++ position is c:\mingw32\bin\g++.exe.

(2) QT Library installation

Run Qt-opensource-windows-x86-mingw482-4.8.6-1.exe, this package is larger, the decompression time is longer, and so on for a while to enter the installation interface:

Click Next to enter:

Click Next to enter the agreement consent page:

Select the Accept Agreement terms and click Next to enter the build selection screen:

Select all, then click Next to go to the target directory selection:

If the C disk space is not enough, select another partition, then click Next to enter the Start menu settings:

Click Next to enter the MinGW selection page:

Set the correct MinGW folder, if the path setting error Click Install will prompt

At this time select "No", reset the correct mingw path, click Install will start the actual installation. Wait for the installation to finish, cancel the following two check boxes and click Finish:

The first one above is an example, and the second is a QT document.
In the Start menu, QT by Digia v4.8.6 (MinGW 4.8.2 opensource) is a quick menu item for the QT library:
①assistant, Help document view
②designer, a graphical editing UI file, is the QT graphical interface design program
③examples and DEMOS,QT program examples
④linguist, international language translation tool
⑤QT 4.8.6 (Build Debug Libraries), create debug repository, this can be no matter.
⑥QT 4.8.6 Command-line development environment settings, this command-line tool will set the Qt location and MinGW location, you can compile C + + and QT programs from the command line.
⑦QT Readme, Readme file, description Qt information
⑧QT.DIGIA.COM,QT website Link
⑨uninstall qt opensource 4.8.6, uninstall QT Library.
To open qt 4.8.6 command Prompt, you can try running the command to see the version information:
G++–version
Qmake–version


This command-line tool corresponds to the command:
%comspec%/k "C:\Qt\4.8.6\bin\qtvars.bat"
In other words, if you want to configure the MinGW version and the QT Library yourself, you can learn the Qtvars.bat file to write your own bat file, such as

@echo off
Rem
REM This file is generated
Rem

Echo Setting up a MINGW/QT only environment ...
Echo–qtdir set to C:\Qt\4.8.6
Echo–path set to C:\Qt\4.8.6\bin
Echo–adding C:\mingw32\bin to PATH
echo–adding%SystemRoot%\System32 to PATH
Echo–qmakespec set to win32-g++-4.6

Set qtdir=c:\qt\4.8.6
Set Path=c:\qt\4.8.6\bin
Set path=%path%; C:\mingw32\bin
Set Path=%path%;%systemroot%\system32
Set qmakespec=win32-g++-4.6

%comspec%/k

The first paragraph above is the turn off command echo, indicating that the command is not printed when the command is executed.
The second paragraph shows the information you want to display and prints the five elements.
The third paragraph is the actual command that sets the environment variable, which is the five hint:
Qtdir indicates QT 4.8.6 root directory, middle three sentence set path, including QT tool bin path, MinGW bin path and operating system System32 path, QMAKESPEC is the target platform for compiling QT program.
%comspec%/k is the meaning of Cmd.exe to keep running after executing the command.

(3) Qtcreator installation

If you want to compile the QT program from the command line, the above environment is enough. Of course, are now visual development, it is necessary to install Qtcreator integrated development environment, because the Qtcreator is convenient and quick to use.
Run Qt-creator-opensource-windows-x86-3.3.0.exe,


Click "Next" to enter the directory to specify the interface:

After setting the installation location, click "Next" to enter the consent interface:

Select Accept permission and click Next:

Click "Next",

Click Install,

Click "Next",

Click "Done" and the Qtcreator will open:

(4) Qtcreator configuration

Because Qtcreator is not configured yet, it is not possible to compile the program at this time.
Open the Qtcreator menu "Tools" –> "Options" and select "Build and Run" on the left side of the dialog box:


To compile a QT program, you must configure several things to be configured:
Build Kit (Kit), qtversions, compiler, debuggers.

①debuggers


Click Add to enter the new Debugger Settings screen:

Set name to GDB and click "Browse" at the far right of the path line to find the location of the Gdb.exe,
Set the debugger when you click "Apply" in the lower right corner.

② compiler


Click "Add" on the right, pop-up menu has MinGW, GCC, Clang, Custom and QCC, select MinGW,

The name is set to MinGW, for the compiler path settings, browse to find G++.exe, set these two are enough, and then click on the lower right corner "Apply".

③QT Versions


Click "Add", pop up the file find box, is to select the Qmake.exe location, before the location is:
C:\Qt\4.8.6\bin\qmake.exe, check Qmake.exe


Click Open, then the QT version will automatically detect:

Click "Apply" to configure the Qt library.

④ Build Kit (KIT)


The last three configurations are all built for the build suite, and you need to select the three before you choose: The compiler chooses "MinGW", the debugger chooses "GDB", the QT version chooses "QT 4.8.6 (4.8.6)", QT Mkspec can be used without a tube, Because Qmake.exe can be set automatically. After you have configured the compiler, debugger, and QT versions, click "Apply" and then click "OK". The configuration is finally ready.

Then you can create a new project, select "Qt Widgets Application", all with the default project settings, always click Next, then click "Done" to see the code:


Click the bottom left corner of the third icon, which is the pure triangle:

The program will compile and run normally.

Second, Qt 5.4.0 download and install

After reading the installation configuration of the QT4 development environment above, QT 5.4.0 installation (no configuration required) is particularly straightforward. It's a stupid bag. Note Select components when selecting them all, then always click "Next" to finish. Let's take a brief look.

1. Download Qt5.4.0 Development environment

http://www.qt.io/download-open-source/
Click "View all Downloads" to locate the "Offline Installers" Offline installation package,
There are Linux, MacOS, and windows, about the QT installation package in Windows systems:


The first two are the VS2013 64-bit version of the QT Library, with OpenGL and non-OpenGL versions, OpenGL version refers to the underlying drawing with OpenGL driver, non-OpenGL bottom is the DirectX driver to draw. The third and fourth is the VS2013 32-bit version, and the fifth sixth is the QT Library of VS2012 and VS2010. It is important to note that the program compiled by Microsoft VS2012 will not run on windowsxp (XP can be patched). It is not recommended to use Visual Studio to develop Qt programs, because vs does not have Qt creator Handy, vs is always a puzzling problem.
The best is to download Qt 5.4.0 for Windows 32-bit (MinGW 4.9.1, 852 MB).
The eighth download list is for Android (more hassle, there are tutorials online).
The Nineth is a QT library for the Windows RT operating system (typically used on Windows tablets).
Download MinGW version of QT file is:
Qt-opensource-windows-x86-mingw491_opengl-5.4.0.exe
After running, wait for the exe file to start and decompress itself, which may take a long time, because the file is very large.

2. Installation


Click Next,

Click Next to enter the component selection screen:

Here to pay attention to all things, the first MinGW 4.9.1 refers to the use of MinGW compiled QT Library, the second MinGW is the real compilation debugging environment.
Select All and then click Next:

Select Agree and then click Next:


Click Next:

Click Install, wait for the installation, and click "Finish".

Because the installation package brings everything together, you can use Qtcreator to create, compile, and build programs directly. If there are multiple QT build suites on this machine, when you create a new project, Kit Selection:

Multiple QT Build suites can be selected, and different packages will generate different programs. Compile-time in the lower left corner of the word debug or release, you can choose a different QT library to generate their own debug version of the program or release version of the program.

Iii. How to publish a well-developed executable program

In general, the official QT development environment, generated EXE are dynamic link version, if you want to put on other computers to run, you need to copy a lot of dependent DLLs, and the number is more, is a problem.

If you want to use an EXE neat release program, you need to use the static compiled version of the QT Library, there are tutorials online, I will not say, can teach you to use off-the-shelf, on the git-hub just have a static QT library:

Https://github.com/fostersoftware/QtStaticWindows

Https://github.com/fostersoftware/QtStaticLinux

The second one is Linux, the Windows system download the first qtstaticwindows, it is best to use the Git tool to download, create a new qtsatic folder, in this folder to execute:

git clone https://github.com/fostersoftware/QtStaticWindows.git

After the download is complete, add the QT Static Library method to reference the first part of 4. (4) Qtcreator configuration, just add the new Qt version and the New Build kit (kit) inside the qtcreator.
Note that only the release version of the QT library above, so in the use of the official QT Dynamic library development debugging completed, finally use the static release version of the QT library to generate a separate EXE program, you can put on other machines to run.

Qt Creator Download and install (detailed tutorial)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.