After using the Application Wizard to generate the framework program, we can see a folder named after the solution name under the location of the previous settings, which contains several files and a subfolder named after the project name . This subfolder also contains several files and a res folder, and the files under the project folder may vary depending on the options when you create the project.
If you have compiled the link in debug mode , you will have a folder named "Debug" under the Solution folder and the Project subfolder, and if you compile with release, you will be named "release". These two compilations will result in two different versions of the executable program:Debug version and release version . The debug version of the executable contains the information and code for debugging , while the release version does not have debug information and cannot be debugged, but the executable file is relatively small .
All files are divided into 6 parts: solution-related files, project-related files, application header files and source files, resource files, precompiled header files, and compilation links to deliver files.
1. Solution-related Documents
Solution-related files include the . sdf file, the. sln file, the. suo file, and the Ipch folder under the solution folder.
The . sdf file and the ipch directory typically occupy a larger space , a few 10 trillion or even hundreds of megabytes, related to smart hints, error hints, code recovery, and team local repositories . If you feel you don't need to, you can set them up without generating them by clicking the menu bar tools->options, pop Up the Options dialog, select the text editor->c/c++->advanced in the left panel, The first item in the list on the right disable database is changed from false to true, and the last time you close VS2010 and then delete the. sdf file and the IPCH directory will not be created again. However, there will be a lot of inconvenience when this option is turned off, such as the smart tip when writing a program.
. ipch the following files and. sdf files are large, at least 10M, and large items may be over 100M, and these files are used by Visual Studio to save precompiled header Files and Intellisense . Deleting these files has no effect on the development of the project at all.
The. sln file and the. suo file are the MFC auto-generated solution files that contain the project information in the current solution and the settings for the storage solution .
2. Engineering Related Documents
Project-related files include . vcxproj files and . vcxproj.filters files under the project folder.
The. vcxproj file is an MFC-generated engineering file that contains information about the current project's settings and the files that the project contains .. vcxproj.filters Files Store the project's virtual directory information, which is the directory structure information in the solution browser.
3. Application header files and source files
The application Wizard automatically generates some header and source files based on the type of application (single document, multi-document, or dialog-based program), which is the body of the project and is used to implement the main frame, document, view, etc. .
Below is a brief description of each file:
HelloWorld.h: The primary header file for the application. It mainly contains the declaration of the Chelloworldapp class derived from the CWinAppEx class, and the declaration of the Global object Theapp of the Chelloworldapp class.
HelloWorld.cpp: The main source file for the application. It mainly contains the implementation of Chelloworldapp class, the definition of global object Theapp of Chelloworldapp class, etc.
MainFrm.h and MainFrm.cpp: These two files derive CMainFrame classes from the CFrameWndEx class for creating the main frame, menu bar, toolbars, and status bar.
HelloWorldDoc.h and HelloWorldDoc.cpp: These two files derive the document class Chelloworlddoc from the CDocument class, including some member functions for initializing documents, serializing (saving and loading) documents, and debugging.
HelloWorldView.h and HelloWorldView.cpp: They derive from the CView Class A view class known as Chelloworldview, which is used to display and print document data, including some drawings and member functions for debugging.
ClassView.h and ClassView.cpp: derived from the CDockablePane class Cclassview class for implementing class View on the left panel of the application interface.
FileView.h and FileView.cpp: derived from the CDockablePane class Cfileview class for implementing file View on the left panel of the application interface.
OutputWnd.h and OutputWnd.cpp: derived from the CDockablePane class, the Coutputwnd class is used to implement the side panel output under the application interface.
PropertiesWnd.h and PropertiesWnd.cpp: derived from the CDockablePane class Cpropertieswnd class for implementing the Application interface right panel properties.
ViewTree.h and ViewTree.cpp: The Cviewtree class is derived from the CTreeCtrl class for implementing a tree view that appears in ClassView, FileView, and so on.
4. resource Files
Generally we use the MFC Build Window program will have dialog boxes, icons, menus and other resources, the Application Wizard will generate resource-related files :res directory, helloworld.rc file and Resource.h file .
Res directory: The res directory under the project folder contains icon files such as application default icons, toolbar use icons, and so on .
helloworld.rc: contains the default menu definition, String table, and accelerator key table , specifying the default About dialog box and application default icon file.
Resource.h: contains ID definitions for various resources .
5. Precompiled Header File
Almost all MFC programs contain files such as AFXWIN.h , and if compiled once each time, the compilation speed will be greatly slowed down. So the common MFC header files are put in the stdafx.h file , and then by Stdafx.cpp contains stdafx.h files , the compiler to stdafx.cpp only compile once, and Generates compiled precompiled header helloworld.pch, which greatly improves compilation efficiency .
6. Compile the link to the file
if it is compiled in debug mode, the Debug subfolder is generated under both the solution folder and the project folder, and the release subfolder is generated if the release method is compiled.
The Debug or Release subfolder under the project folder contains the intermediate files that are generated when the link is compiled , the Debug or release subfolders under the solution folder contains an executable file with an application in the main.
VS2010 the composition of files in an application project