Visual Studio 2015 Custom file compilation

Source: Internet
Author: User

After compiling the QT 5.6.0 Alpha version yourself, how do I use VS2015 to create a QT project?

1, install the plug-in, installation failed! Because VS2015 no longer supports ADDIN, Qt-vs-addin can only support VS2013

2, use Qtcreator, this is not accustomed to use, and slow

3. DIY

The first idea is to traverse the project file to find the required files before compiling the project, compile the corresponding files using UIC, MOC, and then compile the

But how do we do that? I happen to think of CUDA's installation tutorial with instructions on how to compile the VS2010 custom file type, so find

C:\Program files (x86) \msbuild\microsoft.cpp\v4.0\v140\buildcustomizations directory with MASM custom compilation process configuration file

Masm.props Masm.targets masm.xml three files

As a result, configure how the UI file generates ui_*.h, how TS generates *.QM, and *.h generates MOC_*.H, which reference the following

In Solution Explorer, right-click on the project, select the "Build Dependencies"/"Build custom" list to see the three items of QUI, QMO, QTS, select the three items, and tap the OK button

Then add UI or TS files to the project, and these files can be compiled by UIC or Lrelease before compiling the precompiled header.

For. h files, it is necessary to manually modify the "item type" to "QT MetaObject header" in the properties of the file, which does not affect the opening of the header file for editing, the identification of the type definition, only the compile-time is no longer a normal header file, but can be the MOC file, so only need to have q_ in the type The header file defined by OBJECT is modified to "QT MetaObject header";

When compiling a project, first compile the UI, TS, and the required header files, then the precompiled header, then the files in the project

You need to be aware of the files in your project, for example, in the AppOutput.cpp file, you need

" AppOutput.h "  "ui_appoutput.h " "Moc_appoutput.h"

If there is a UI file, then you need a second line, if there is q_object in the header file, then a third line is required

Compile, connect, OK, do not need plug-ins can also compile QT project properly;

Note that you need to create a directory in the same location as the project file. Generatefiles, used to store generated ui_*.h and moc_*.h and QM files

Configuration file Download Connection: Http://files.cnblogs.com/files/WonKerr/BuildCustomizations.zip

or download directly

Visual Studio 2015 Custom file compilation

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.