The QT development environment is built under Windows VisualStudio and Qtcreator

Source: Internet
Author: User
Tags visual studio 2010

First, the introduction of integrated development platform IDE has its own strengths, writing QT program can be based on their preferences to choose the appropriate IDE. The following articles are loaded with Bo Friends of the article, which has a lot of details to adjust themselves. Second, detailed 1, VisualStudio build QT Development environment
    • Visual Studio Chinese official website
    • All Visual Studio Downloads
(1) Visual Studio Community

1, select Community 2013, download and install

2, installed Visual Studio by default is English, if the English is not cold children's shoes, you can download the Chinese language pack.

3, after the installation is complete, you need to set up to take effect.

Open Visual Studio, select Tools->options->environment->international Settings, and the language configuration option appears on the right. Language default is the current 中文版, click the drop-down arrow, select Chinese (Simplified), click OK.

Note: I have converted to Chinese after the interface.

After the Chinese Language pack configuration is complete, this is still the English version, and restarting Visual Studio 2013 is the Chinese version.

Note: If you are Windows 7 and you need to install Visual Studio 2013, you need to have Windows 7 Service Pack 1 and IE10 or later support.

    • Windows 7 and Windows Server R2 Service Pack 1 Downloads

(2) Qt for Visual Studio2013 download

Download the Qt5.5 installation package (Qt-windows-opensource) with the QT plugin (Visual Studio add-in)

QT Download
QT All Downloads
QT Official release download
Open Source Download

Find the corresponding version to download, which contains a number of different versions, MSVC2010, MSVC2012, MSVC2013, respectively, refers to support Visual Studio 2010, Visual Studio 2012, Visual Studio 2013 QT version; Android, iOS is the QT version that supports Android and iOS, and the difference between OpenGL and non-OpenGL is whether opengl;x86, x64, respectively, support 32-bit and 64-bit operating systems.

The version I chose here is: Qt-opensource-windows-x86-msvc2013-5.5.1.exe (32-bit support for Visual Studio 2013)

(3) Qt for Visual Studio2013 installation

Qt-opensource and Visual Studio add-in installation order is not required, the installation process no longer say (fool-next), the installation path does not include Chinese, spaces, special characters (~<>|? *[email protected]#$%^&:,;).

After the installation finishes Visual Studio add-in, the appropriate QT options will appear in Visual Studio!

Configuring the development environment

Select: QT5->QT options->add, configure the development environment for QT.

Here is a selection based on the Qt installation path, path: D:\Qt\Qt5.5.1\5.5\msvc2013.

Run the program

Import QT Project

Select: Qt5->open Qt Project File (. Pro) ...

New QT Project

1, select: File--New project->QT5 PROJECTS->QT application, enter project name, next ... To create a new.

2, select: Qt5 project->qt application, then fill in the project name (Hello World)

3, select the dependent module: The most basic Qtcore, Qtgui, Qtwidgets also have some audio/video, network, database, XML, OpenGL related modules, need to use the direct check.

4, compile Run, select: Debug, start execution or CTRL+F5.

Configuring Environment variables

If the environment variable is not configured, then the executable program is found in the project directory, and the *.dll error message will appear when running directly.

Workaround:

(1) Environment variables, advanced system settings, properties, right-click Computer, add environment variables (recommended)

    • qtdir:d:\qt\qt5.5.1\5.5\msvc2013
    • Path:%qtdir%\bin

(2) Locate the missing *.dll (D:\Qt\Qt5.5.1\5.5\msvc2013\bin) in the Qt installation directory, and place it in the same directory as the executable program (not recommended).

(4) Visual Studio2010 MSDN Installation Method VS2010 The official version no longer has a separate MSDN Library installation option so that the local MSDN Library is not available, in fact the VS2010 ISO installation CD already contains the MSDN Lib Rary, just want to install manually, the method is as follows:
1. After installing VS2010, open the Microsoft Visual Studio 2010-visual Studio Tools–manage help Settings in the Start menu and let you select a path to save the MSDN Lib when you first open it Rary, it is recommended that you choose a larger disk with more space left.
2. Click "Choose online or local Help" and select "I want to use local Help"
3. Click "Install content from disk" and select the Productdocumentation\helpcontentsetup.msha file under the VS2010 installation CD
4. Click "Add" to select the MSDN Library content you want to install, then click OK to start the installation
5. (optional) Click "Check for Updates online" to update the local MSDN Library document to the latest content.
VS2010 is not called the MSDN Library, but called the Help Library, in VS2010 press F1 can open the Help library, the first time you open an additional Help library agent process, and then call the default browser to open Help Library. (5) Vs2010+qt4 compile error LNK2001: unresolved external symbol "public:virtual struct qmetaobject and other errors

1. When VS2010 compiles QT, the following error occurs:

1>------started rebuild All: project: mydialog, config: Debug Win32------
1> build Start time is 2015/9/9 14:57:04.
1>initializebuildstatus:
1> is creating "Debug\mydialog.unsuccessfulbuild" because "AlwaysCreate" is already specified.
1>custombuild:
1> Moc ' ing LoginDlg.h ...
1>clcompile:
1> LoginDlg.cpp
1> main.cpp
1> is generating code ...
1>logindlg.obj:error LNK2001: unresolved external symbol "public:virtual struct qmetaobject const * __thiscall clogindlg::metaobject ( void) const "(?[email protected]@@[email protected]@XZ)
1>logindlg.obj:error LNK2001: unresolved external symbol "public:virtual void * __thiscall clogindlg::qt_metacast (char const *)" ([email protected]@@[email protected])
1>logindlg.obj:error LNK2001: unresolved external symbol "Public:virtual int __thiscall clogindlg::qt_metacall (enum Qmetaobject:: Call,int,void *) "([email protected]@@[email protected]@@[email protected])
1>d:\vc++\qtt\mydialog\\mydialog.exe:fatal error Lnk1120:3 an unresolved external command
1>
1> build failed.
1>
1> used Time 00:00:03.23
========== All rebuilds: 0 successful, 1 failed, 0 ========== skipped

2, the cause of the above error is due to missing a moc_xxx.cpp file in the Generatedfiles/debug file, as shown in:

3. What is the missing file name? So first to find the Q_object macro in that header file, such as in the macro in the LoginDlg.h file, then the generated file Moc_logindlg.cpp, to generate this file requires a Moc.exe file in the QT library, as shown in:

4. Enter into this directory via CMD and execute: MOC "d:\vc++\qtt\mydialog\mydialog\logindlg.h"-O "d:\vc++\qtt\mydialog\mydialog\moc_ LoginDlg.cpp "

As shown in the following:

5. A moc_logindlg.cpp file is then generated in the D:\vc++\qtt\mydialog\mydialog\ directory, as shown in:

6. Copy the Moc_logindlg.cpp file to the Generatedfiles/debug directory and add the file to VS, as shown in:

7, re-compile can, such as:

2, Qtcreator build QT development environment

Qt Creator3.4.1 + mingw-gcc440_1 + qt4.6.2

Download the following three files

Qt-creator-windows-opensource-3.4.1.exe

Qt-win-opensource-4.6.2-mingw.exe

Mingw-gcc440_1.zip

Installation steps:

1. Install Qt Creator3.4.1, install directory for C:\Qt\qtcreator-3.4.1

2. Unzip mingw-gcc440_1 to directory C:\Qt\MinGW-gcc440_1

3. Install QT-WIN-OPENSOURCE-4.6.2-MINGW, select MinGW in the Find installed MinGW directory for C:\Qt\MinGW-gcc440_1

4. Open Qtcreator, Tools-Options-QT version, Qmake path selection C:\Qt\4.6.2\bin\qmake.exe

5. Compiler add MinGW, path selection D:qt\mingw-gcc440_1\bin\mingw32-g++.exe

6. Configure Kits,complier Select MINGW,QT Version Selection Qt4.6.2

Ready to use.

Iii. Summary(1) The above steps are referred to the online documentation, reserved for later review.
(2) If there are questions or suggestions, please leave a message, thank you here!

Top
0
Step

The QT development environment is built under Windows VisualStudio and Qtcreator

Related Article

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.