File Types and compilation options in the VC6 project [ZT]

Source: Internet
Author: User
1. Common VC6 project files
//////////////////////////////////////// //////////////////////
The. opt project parameter file for the development environment. Such as tool bar location and other information.
. Aps (AppStudio File), Resource auxiliary File, binary format, usually don't worry about it.
. The clw ClassWizard information file is actually in the INI file format. If you are interested, please study it. sometimes the ClassWizard has a problem. You can manually modify the CLW file to solve the problem. if this file does not exist, you will be prompted to re-create it each time you use ClassWizard.
. Dsp (idea studio Project) Project file, text format, but do not modify it manually if you are not familiar with it.
. Dsw (workflow studio Workspace) is a Workspace file. Other features are similar to those of DSP.
. Plg is a compilation information file. The error and warning information files during compilation (actually an html file) are generally of little use.
There is an option in Tools-> Options to control the generation of this file.
. Hpj (Help Project) is the Project for generating Help files, which can be processed using microsfot Help Compiler.
. Mdp (Microsoft DevStudio Project) is an earlier version of the Project file. To open this file, you will be prompted to convert it to a new DSP format.
. Bsc is used to browse project information. This file is required if Source Brower is used. if you do not need this function, you can remove the Generate Browse Info File in Project Options to speed up compilation.
. Map is the image information record file of the execution file, unless you are very familiar with the underlying system, this file is generally not needed.
. Pch (Pre-Compiled File) is a Pre-Compiled File, which can speed up compilation, but the File is very large.
. Pdb (Program Database) Records Program-related data and debugging information, which may be useful during debugging.
. Exp is generated only when the DLL is compiled, and some information in the DLL file is recorded. It is generally useless.
. Ncb does not compile the Browse File (no compile browser). When the function is automatically completed, you can delete this file. The file is automatically generated after build.

2. MFC project file
//////////////////////////////////////// //////////
When we use Application Wizard to generate a new project, MFC will automatically generate many program files for us. What are these files used? After the project is created, we will find a readme.txt file in the project directory. The program files generated by the project are described here, but they are generally in English. While the Application Wizard generates the project, it also shows the program framework that the MFC mechanism has laid for us and provides us with programs for extension. Depending on different options, the generated files are also different. The following is the standard program file generated by Application Wizard (assuming the project name is ExMFC), which can be roughly divided into the following categories:
· Workspace files, project files, and make files
· Application source files and header files
· Resource files
· Pre-compiled header files
· AppWizard Files Added by option

Workspace, project file, and make File
ExMFC. dsp-this is a project file generated by MFC. It contains the settings of the current project and the files contained.
ExMFC. dsw-this is a workspace file automatically generated by MFC. It contains information about the projects in the current workspace.
ExMFC. MAK-this is the project file of the MFC project, which is also compatible with NMAKE. If you select the External make file option, you can manually edit it,
However, you cannot use many project editing features of Visual C ++.
ExMFC. clw-This file contains information that is used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to save and create and edit message ing and
The information required by the dialog box data or the information required to create a virtual member function.

Application source file and header file
ExMFC. h-this is the main header file of the application. It contains all the global symbols and the # include directive used to include other header files.
ExMFC. cpp-this file is the main source file of the application. It creates an object of the CExMFCApp class (derived from CWinApp) and overwrites the InitInstance member function.
MainFrm. h, MainFrm. cpp-these two files will derive the CMainFrame class from CFrameWnd (SDI application) or CMDIFrameWnd (MDI application.
If the corresponding Options are selected on the Application Options page of AppWizard (step 1 in Step 6), The CMainFrame class processes the creation of toolbar buttons and status bars. The MAINFRM. CPP file also contains the Object ID of the default toolbar button provided by the MFC Application-called the buttons array.
ExMFCDoc. h, ExMFCDoc. cpp-these files are derived from the CDocument class and implement the document class named CExMFCDoc, and contain documentation for initialization,
Serialization (save and load) documentation and framework of some member functions used for debugging and diagnosis.
ExMFCView. h, ExMFCView. cpp-these files are derived and implemented as the CExMFCView class for displaying and printing document data.
The CHelloView class is derived from CView or its derived class and contains some member function frameworks for rendering views and debugging and diagnosis.

Resource file
ExMFC. rc, Resource. h, ExMFC. rc2-this is the project header file and its Resource file. The resource file contains the default menu definition and acceleration key table of the common MFC application,
String table. It also specifies the default About dialog box and an icon file (res \ ExMFC. ico ). The resource file contains resources of the Standard MFC class.
If you specify support TOOLBAR, it also specifies the TOOLBAR bitmap file (RES \ TOOLBAR. BMP ). ExMFC. rc2 is used to store resources that cannot be directly edited by Visual Studio.

Precompiled header files: STDAFX. CPP, STDAFX. H
These two files are used to create a pre-compiled header file ExMFC. PCH and a pre-defined type file STDAFX. OBJ. Because the MFC architecture is very large and contains many header files,
It takes a long time to compile each time. Therefore, we place common MFC header files in stdafx. h, such as afxwin. h, afxext. h, afxdisp. h, and afxcen. h,
Then let stdafx. cpp include this stdafx. h file. In this way, the compiler can identify which files have been compiled, so stdafx. cpp is compiled only once,
And generate the so-called pre-compiled header file (because it stores the information after the header file is compiled, hence the name ). If you do not want to compile some MFC header files during programming in the future,
You can also add it to stdafx. h. Pre-compiled header files can accelerate the compilation process.
Now you may have a good understanding of the program files generated by AppWizard, and the rest is to add something you want to complete specific functions.

3. Setting
//////////////////////////////////////// ////////////////
Open or create a Workspace that contains at least one Project ..." The command becomes effective. After you select it or press the hot key Alt + F7, the project Setting dialog box can be called up. The options here will affect the entire project establishment and debugging process, so it is very important, although most of the options do not need to be changed in general, understanding their meanings can eliminate the mysteries in our hearts and deepen our understanding of VC projects.

In this dialog box, the drop-down list box in the upper-left corner is used to select a project configuration, including Win32 Debug, Win32 Release, and All comprehenations ), some options have different default values in different project configurations. The Tree View on the left shows all the files and categories of the current project. If we set the project "Schedule" to highlighted, a total of ten tabs will appear on the right of the dialog box, listing various project-related options. Many Tabs have a Reset button, click it to restore the settings in the tab to the initial values when the project is generated. If we select a file class or a file in the Tree View, the tabs on the right of the dialog box will be automatically reduced to one or two, listing all the options related to the selected file class or file. Next, we will take Win32 Debug as an example to look at the functions and meanings of the ten tabs related to the project. For tabs related to the file, please think about them by yourself.

General
This tab is relatively simple. The first option from the top down is used to change the method of using the MFC class library. Do you still remember that we specified to use the MFC class library as a DLL in step 5 of AppWizard? But now we can switch between the two methods at will. The second option is used to specify the directory for storing intermediate and output files generated during the compilation and connection process. For debugging versions, the default directory is the "Debug" subdirectory under the project. The third option at the bottom is used to specify whether each project configuration can have its own file dependency (main finger file ), because the debugging and release versions of most projects share the same file dependency, you do not need to change this option.

Debug
The Debug tab contains debugging-related options. Because there are many options, they are divided into several classes. We can select different categories from the Category, the corresponding options are displayed. The C/C ++ and Link tabs are also displayed. In the General category, we can specify the executable file name to be debugged. If the program being compiled is a DLL, we should specify an EXE file to debug the DLL here. The other three options can be used to specify the working directory for debugging, the command line parameters sent to the program at the start of debugging, and the path of the executable file during remote debugging. After switching the category to Additional DLLs, we can specify whether to load the debugging symbol information for some Additional DLL at the start of the debugging. Only after the symbolic information is loaded Can we track the DLL.

C/C ++
The C/C ++ tab controls the VC6 compiler. It has many options and is complex. There is a Project Options edit box at the bottom. The various command switches listed in will be transmitted to the VC6 compiler as command line parameters at the beginning of compilation to control the compilation process. These command switches change with other options. If you know some command switches, you can directly enter them in this edit box.
In the General category, the Warning level is used to specify the level at which the compiler displays warnings. None indicates that no Warning is displayed, L1 indicates that only severe warnings are displayed, and L2 indicates that warnings are worse than L1, l3 indicates a warning that is worse than L2, L4 indicates that all Warnings are displayed, including those that are ignored for security. If Warnings as errors is selected, each warning will cause an error. After compilation, the connector cannot be started for connection. The C/C ++ syntax is quite complex and strict, although the editor does not interrupt the project creation process after a warning is generated, however, warning information often indicates that the program has potential problems in some places. Therefore, we recommend that you set the warning level to L3 in the future and eliminate the warnings generated during compilation as much as possible.
Optimizations is used to set the code optimization method. The optimization mainly aims to improve the running speed and reduce the program volume. However, sometimes these two purposes are mutually contradictory. In addition, in rare cases, the program runs normally without optimization. After the optimization measures are enabled, some inexplicable problems may occur in the program. In fact, most of these are potential errors in the program. Shutting Down optimization measures is often just a temporary solution.
Debug info is used to specify the type of debugging information generated by the compiler. VC6 supports the out-of-the-box editing function. To use this function, you must generate the debugging information of the "Program Database for Edit and Continue" type here, but cannot generate debugging information compatible with earlier compilers.
Preprocessor definitions is some pre-defined macro names. These macros are widely used in the MFC class library and Windows header files to set Conditional compilation.
The options in the C ++ Language class involve some advanced features of the C ++ Language, including representation of member pointers, exception handling, runtime type information, and construction displacement, they all have profound concepts, so We generally don't need to change them.
The options in the Code Generation category involve how to generate the target Code, here, we can select the type of the target processor, the type of the Runtime Library, the default transmission mode of parameters for function calling, and the alignment mode of structure members. In general, we can keep the default value.
In the Customize category, the six options from top to bottom have the following meanings: whether to disable Microsoft's extension to C ++, whether to allow function-level connections, and whether to eliminate repeated strings; whether to allow minimal reconstruction; whether to allow incremental compilation; whether to allow the compiler to Output its version information to the Output window at the start of running. The second and third items are gray because they are not compatible with the out-of-the-box editing function. If you select to generate debugging information of other types in the General category, you can change these two options.
In the Listing Files category, you can specify the compiler to generate the browsing information and Listing file. The former can be generated by the browser information maintenance tool BSCMAKE, the latter contains the compilation commands corresponding to the C/C ++ source file after compilation.
The Optimizations category allows us to control the optimization measures in more detail. After selecting Customize, we can select which Optimizations to perform, in Inline expansion, we can specify the Extension Method for Inline functions.
The Precompiled Headers class contains some options for Precompiled header files, which are generally not changed. Preprocessor categories have some options for preprocessing. Here we can pre-define some macro names, specify some or all symbols with undefined states, and specify the directory where the extra files are contained.

Link
The Link tab controls the VC6 connector, which is also complicated.
In the General category, we can specify the output file name and some additional library files or target files to be used during the connection. The following five options are described as follows: generate debugging information; ignore all default library files; allow incremental connection (this method can speed up the connection); generate MAP files; allow performance analysis.
Some options in the Customize category are the same as those in the General category. Select Use program database to allow the Use of the program database, so that the connector stores debugging information in the program database. If this option is not selected, the incremental connection method cannot be used. If Force file output is selected, the connector will still generate a valid (but not necessarily run correctly) executable file even if a module references undefined or repeatedly defined symbols.
In the Debug category, we can specify whether the debugging information is in Microsoft format, COFF format, or both, after Separate types is selected, the connector will Separate the debugging information and put it in the PDB file. This will make the connection faster, but the debugging speed will be slower.
The Input class contains some options related to the Input library file. Here we can specify to use or not use some library files or target files.
In the Output class, there are some options related to the final Output executable file, including: the base address of the program load, the entry address of the program, how much space is reserved for the stack, and the version number of the program. Although these options are empty, they all have their own default values, and generally do not need to be changed.

Resources
The Resources tab controls the VC6 resource compiler. We can specify the path of the resource file generated after compilation, the language type of the resource, and the additional resource inclusion directory.

MIDL
This tab is related to the programming of COM (Component Object Model). We will not discuss it.

Browse Info
On this tab, we can specify whether to generate a browse information file while creating the project. With this file, we can use
The corresponding commands of the Association menu quickly locate the definition or reference of a symbol.

Custom Build
This Tab allows us to add our own steps for creating a project. In Commands, enter the command to be executed, and in Outputs, enter the output file obtained after the command is executed,
VC6 checks the time sequence between the output file and the source file, so that you can run the specified command again when necessary to regenerate the output file.

Pre-link step
This tab is used to add the command to be executed before the connection.

Post-build step
This tab is used to add the command to be executed after the project is created.

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.