MFC modifies default build files and default build project content

Source: Internet
Author: User

It is very practical to modify the default build files and the contents of the default build project! Because of this we do not need to create a new project every time to do some of the previous work, such as the use of OpenCV to include its header files and so on, of course, in the. h file by default directly add the author, the company's description will also appear more convenient, the method is as follows:

    The first is to modify the default build content of the. h and. cpp files (that is, when you add a new item, the file will bring the content you added instead of a blank piece), the problem is to find its template file path, my path is "hfile.h" " newc++file.cpp " These two files are blank by default, the former corresponds to the. h file of our new item, and the latter is the. cpp file for the new item, which means that we modify the contents of the two files to modify the default generated content accordingly. If you follow the default path to install VS, you may be unable to modify the file, I took the method is to modify the contents of the file outside the desired appearance, and then named "hfile.h" or " newc++file.cpp "re-copy in. of course, It is also perfectly possible to open the editor as an administrator and then open the corresponding file modification.

next to Focus, modify the default build project!

here with the MFC new project For example, first we want to find the template path (find me very bitter, this article helped a lot) if the English version in this path:"C:\Program Files (x86) \microsoft Visual Studio 12.0\vc\vcwizards\appwiz\mfc\application\templates\1033", Chinese version in this path: "C:\Program Files (x86) \microsoft Visual Studio 12.0\vc\vcwizards\appwiz\mfc\application\templates\2052" , of course, as above, if your VS is not installed with the default path or not 2013, the path will be slightly different. After finding the path, everything is going to be a lot more, in the Chinese version, for example, the. h and. cpp files in the path shown above correspond to those files created by default for the new project, where "Dialog.cpp" corresponding to each of the project's default generated message response function files, that is, "XxxDlg.cpp" This file, we can modify the contents of the content to enrich our new project function, For example, add the following code below the OnInitDialog function:

#ifdef _debug::allocconsole ();//Open the console resource file *fp;freopen_s (&FP, "conout$", "w+t", stdout);//apply for write, this is for VS2013 version of the code , in the earlier version of VS, such as VS2008, you can change the freopen_s to Freopen, and change the parameter to the corresponding form #endif
in this way, each project in debug mode can pop up a console-like terminal to print debugging information. As for how to customize other functions, it is no longer here to repeat, the operation is generally ibid.

MFC modifies default build files and default build project content

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.