Vs2010 project structure:
Taking the file structure of the single-document application helloworld created by Using MFC on vs2010 as an example, we briefly describe the file composition structure in vs2010 application project.
1. solution files
Solution files include the. SDF file,. sln file,. suo file, and ipch folder in the solution folder.
. SDF FileAndIpch directoryBrowsing databases is related to smart prompts, error prompts, code recovery, and local team repositories. It supports smart browser-aware editing and display class views, which generally occupy a large amount of space, dozens or even hundreds of megabytes, which is inconvenient for packaging and backup of engineering projects. If you don't think you need them, you can set them not to generate, choose tools> Options> text editor> C/C ++> advanced> Browse/navigation from the menu bar" -> "Disable Database ", disable the database, disable vs2010, and delete the database. the SDF file and the ipch directory will no longer be generated. However, disabling this option will cause a lot of inconvenience. For example, when writing a program, the smart prompt is gone.
. Sln FileAnd. Suo FileAutomatically Generated solution file for MFC, which contains engineering information in the current solution and storage solution settings.
2. engineering documents
Project-related files include the. vcxproj file and. vcxproj. Filters file in the project folder.
. Vcxproj FileIs a project file generated by MFC. It contains the settings of the current project and the files contained in the project.. Vcxproj. Filters FileStores the project's virtual directory information, that is, the directory structure information in the solution browser.
3. Application header files and source files
The Application Wizard automatically generates header files and source files based on the application type (single document, multi-document, or dialog box-based program). These files are the main part of the project, it is used to implement the main framework, documents, views, and so on.
Helloworld. H: The main header file of the application. It mainly includes 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: main source file of the application. It mainly includes the implementation of the chelloworldapp class and the definition of the Global Object theapp of the chelloworldapp class.
Mainfrm. h and mainfrm. cpp: use these two files to derive the cmainframe class from the cframewndex class, which is used to create the main frame, menu bar, toolbar, and status bar.
Helloworlddoc. h and helloworlddoc. cpp: These two files are derived from the cdocument class chelloworlddoc, which contains 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 for displaying and printing document data, including some plotting and debugging member functions.
Classview. h and classview. cpp: The cclassview class is derived from the cdockablepane class to implement the Class View on the left panel of the application interface.
FileView. h and FileView. cpp: The cfileview class is derived from the cdockablepane class to implement the File View on the left panel of the application interface.
Outputwnd. h and outputwnd. cpp: The coutputwnd class derived from the cdockablepane class is used to implement the output on the lower panel of the application interface.
Propertieswnd. h and propertieswnd. cpp: The cdockablepane class is derived from the cdockablepane class to implement the properties on the right panel of the application interface.
Viewtree. h and viewtree. cpp: The cviewtree class derived from the ctreectrl class is used to implement tree views that appear in classview and FileView.
4. Resource files
Generally, the window program generated using MFC has resources such as the dialog box, icon, and menu. The Application Wizard generates resource-related files: res directory, helloworld. RC file, and resource. h file.
Res directory: The res directory in the project folder contains the application default icons, toolbar icons, and other Icon files.
Helloworld. RC: Contains the default menu definition, string table, and acceleration key table, and specifies the default about dialog box and application default icon file.
Resource. h: Id definition containing various resources.
5. Pre-compile the header file
Almost all MFC program files must containAfxwin. hIf the file is compiled every time, the Compilation speed will be greatly slowed down. So we put all the common MFC header filesStdafx. hFile, and thenStdafx. cppContains stdafx. H files. The Compiler only compiles stdafx. cpp once and generates the compiledPre-compiled header helloworld. PCH, Greatly improving the compilation efficiency.
6. Compile links to generate files
If it is compiled in debug mode, a debug sub-folder is generated in both the solution folder and project folder, and a release sub-folder is generated if it is compiled in release mode. These two compilation methods will generate two different versions of executable programs: debug version and release version. The executable file of the debug version contains information and code for debugging, while the release version does not have debugging information and cannot be debugged, but the executable file is relatively small.
The debug or release subfolders in the project folder contain intermediate files generated during the compilation link, the debug or release subfolders in the solution folder mainly contain executable files of applications.
Slimming strategy:
. SDF FileAndIpch directoryBrowsing databases is related to smart prompts, error prompts, code recovery, and local team repositories. It supports smart browser-aware editing and display class views, which generally occupy a large amount of space, dozens of megabytes or even hundreds of megabytes, which is inconvenient for packaging and backup of project projects. If you don't think you need them, you can choose not to generate them.
1. on the menu bar, choose tools> Options> text editor> C/C ++> advanced> Browse/navigation" -> "Disable Database ", disable the database, disable vs2010, and delete the database. the SDF file and the ipch directory will no longer be generated. However, disabling this option will cause a lot of inconvenience. For example, when writing a program, the smart prompt is gone. (Not recommended)
2. Set a special temp directory for the. SDF file and ipch directory, transfer the location of the SDF file and ipch file, and manage it in a unified manner. Method: on the menu bar, choose tools> Options> text editor> C/C ++> advanced> rollback location ", set both to "true" and set the temp directory, as shown in:
3. Write a batch file for cleanup: Create a New. txt file, write the following content into it, and save it as the suffix. BAT file, put it under the project folder, double-click it to automatically delete SDF, ipch and other files that occupy a lot of space. This method is more flexible than transferring the location of the browsing database file, so you do not need to set the vs option. (This method is completely deleted and will not be found in the recycle bin)
ECHO is clearing unnecessary files in vs2010 project. Echo. Please make sure this file is placed in the project directory and close vs2010echo to start cleaning. Please wait ...... echo clears the SDF file del/Q/A/f/S *. sdfecho clears the ipch file del/Q/A/f/s ipch \*. * echo clears the debug file del/Q/A/f/s debug \*. objdel/Q/A/f/s debug \*. tlogdel/Q/A/f/s debug \*. logdel/Q/A/f/s debug \*. idbdel/Q/A/f/s debug \*. pdbdel/Q/A/f/s debug \*. ilkdel/Q/A/f/s debug \*. pchdel/Q/A/f/s debug \*. bscdel/Q/A/f/s debug \*. sbrecho clear the release file del/Q/A/f/s releas E \*. objdel/Q/A/f/S release \*. tlogdel/Q/A/f/S release \*. logdel/Q/A/f/S release \*. idbdel/Q/A/f/S release \*. pdbdel/Q/A/f/S release \*. ilkdel/Q/A/f/S release \*. pchecho clears the temp file del/Q/A/f/s Temp \*. * The ECHO file has been cleared! This program will exit in 3 seconds! Now the countdown ......... @ echo offecho wscript. sleep 300> % Temp %. \ TMP $. vbsset/A I = 3: timeoutif % I % = 0 goto nextsetlocalset/A I = % I %-1 echo countdown ...... % I % cscript // nologo % Temp %. \ TMP $. vbsgoto timeoutgoto end: nextcls & Echo.
Reference URL:
Http://www.jizhuomi.com/software/143.html
Http://blog.csdn.net/menglongbor/article/details/6851933
Vs2010 Project Structure and Its slimming strategy