Additional include directories
, You can specify an additional include directory, which is generally a phase
For the directory of this project, such as ../include.
Connection parameter settings
The project-> Settings-> link page of the VC menu item is used. We can see the bottom of this page
The content in project options is generally as follows:/Nologo/subsystem: Windows/Incremental: Yes
/PDB: "Debug/writingdlgtest. PDB"/debug/machine: i386
/Out: "Debug/writingdlgtest.exe"/pdbtype: sept
Next, let's take a look at the various settings in category.
1) General
Some general settings. You can set the path and file name of the generated file, and the connected library file;
- Generate debug info
To generate the debug information to the. PDB file.
In category-> Debug );
- Ignore all default Libraries
, Discard all default database connections;
- Link incrementally
, By generating.
The ilk file implements incremental connections to increase the subsequent connection speed, but the file (exe or DLL) generated in this mode is usually large;
- Generate mapfile
Generate information about the. map file record module;
- Enable profiling
, This parameter is usually
The mapfile parameter is used at the same time. If debugging information is generated, the. PDB file cannot be used, and Microsoft format must be used.
2) customize
You can set the database file.
- Force file output
To generate an output file (exe or DLL );
- Print progress messages
, You can output the progress information in the connection process
Output Window.
3) debug
Set whether to generate debugging information and the format of debugging information.
- Dubug info
, The format can beMicrosoft format
,Coff
Format (Common Object File Format)
AndBoth formats
Three options;
- Separate types
Indicates whether to store the debug format information in an independent. PDB file or directly
It is stored in the. PDB file of each source file. If selected, the latter method is used. This method is faster for debugging and startup.
4) Input
You can specify the database file to be connected and discard the database file to be connected. You can also add additional library file directories, which are usually relative
Directory of the project, such as ../lib.
- Force symbol references
You can specify a library to connect to a specific symbol definition.
5) Output
- Base Address
You can change the default base address of the program (the default base address of the EXE file is
0x400000, DLL defaults to 0x10000000). When the operating system loads a program, it always tries to start from this base address.
- Entry-point symbol
You can specify the entry address of the program, which is generally a function name (and required
Use the _ stdcall call Convention ). Generally, for Win32 programs, the EXE entry is
In winmain, the DLL entry is dllentrypoint; it is recommended that the connector automatically set the entry point of the program. By default, it is implemented through a C Runtime Library Function: Console
Use maincrtstartup (or wmaincrtstartup) to call the main
(Or wmain) function; windows program uses winmaincrtstartup (or
Wwinmaincrtstartup) calls the winmain (or
Wwinmain, must use the _ stdcall call Convention); DLL uses _ dllmaincrtstartup to call the dllmain function (must use
_ Stdcall ).
- Stack allocations
Used to set the stack size used by the Program (Please use decimal). The default value is
1 MB.
- Version Information
Tell the connector to release the version at the beginning of the EXE or DLL file
The current number.
It is worth noting that:
- The above parameters are case sensitive.
Of;
- Adding "-" after the parameter indicates that the parameter is invalid;
- Each parameter value option is represented by "*" as the default value of this parameter;
- You can use the "reset" button in the upper-right corner of the page to restore all default settings on the page.
Other parameter settings.1)
Project-> Settings-> General, you can set the method to connect to the MFC Library (static or dynamic ). For dynamic connection, when the MFC software is released
Forget the DLL with MFC.
2) Project-> Settings-> Debug: You can set executable files and command line parameters that run during debugging.
3) Project-> Settings-> Custom
Build, you can set to automatically execute some operations after the compilation/connection is successful. When writing COM, you want VC to automatically register the compiled COM file. You can set it as follows:
Description: Register com
Commands: regsvr32/S/C $ (targetpath)
Echo regsvr32 exe. Time> $ (targetdir)/$ (targetname). Trg
Outputs: $ (targetdir)/$ (targetname). Trg
4) Tools-> options-> directories: Set the include and library paths of the system.
Switch all cl.exe commands/C: retained the comment statement in the pre-processing output.
/C: Compile only, no connection, equivalent to selecting "compile" under the "build" menu"
/D: defines constants and macros, which have the same effect as # define in the source program.
/E: Pre-processes the C and C ++ source files, expands all pre-compiled commands and Macros in the source files, removes comments, and copies the output of the pre-processor to the output of the standard output device, and at the beginning of each file and
Add # Line at the end
/EH: Specifies the exception handling model used by the compiler.
/EP: Same as/e, but removed # Line
/F: Set the stack size of the program.
/FA: Specifies the list file to be generated (assembly, assembly and machine code, assembly and source code, assembly and machine code, and source code)
/FA: Specifies the storage path and (or) File Name of the list file set with/FA
/FD: mutual dependency information of generated files
/FD: Set the storage path and/or file name of the program database file (PDB)
/Fe: Set the storage path and/or file name of the final Executable File
/FI: Pre-processes the specified header file, which has the same effect as # include in the source file.
/FM: create a map file
/FO: Set the storage path and (or) File Name of the compiled OBJ file
/FP: Set the storage path and/or file name of the pre-compiled file (PCH)
/FR: generate the browsing information (SBR) File
/FR: Same as/FR. The difference is that/FR does not include local variable information.
/G3: optimized code generation for the 80386 Processor
/G4: optimized code generation for the 80486 Processor
/G5: optimized code generation for the Pentium processor
/G6: optimized code generation for the Pentium Pro Processor
/GA: optimizes Windows Applications
/GB: code generation optimized for the Pentium processor, using 80386, 80486, Pentium, Pentium
The hybrid Instruction Set of Pro is the default option for code generation (processor corresponds to blend in program attribute options)
/GD: optimizes Windows dynamic library (DLL). This switch is not implemented in vc6.
/GD: Specify the function call rules using _ cdecl
/Ge: Activate stack Detection
/GF: removes repeated strings in the program and places them in the read-only buffer.
/GF: removes repeated strings in the program.
/GH: Call the hook function at the beginning of each function-penter
/GI: allow progressive Compilation
/GM: Allows minimal rebuild
/GR: Run-Time type Infomation)
/GR: Specify the function call rules using _ fastcall.
/GS: controls the memory size used for Stack Detection
/GT: supports Fier-safety for data allocated with _ declspec (thread)
/GX: Synchronous exception handling is allowed, which is equivalent to/ESCs switch.
/Gy: allows the compiler to encapsulate each function in the form of comdats for the connector to call.
/GZ: allows you to capture release build errors during debug build.
/GZ: Specify the function call rules using _ stdcall.
/H: restrict the length of external names
/Help: list all the command Switches of the Compiler
/I: Specify the search path for the header file
/J: Change the default char type from signed Char to unsigned char.
/Ld: create a dynamic Connection Library
/LDD: create a dynamic link library of the debug version.
/Link: Pass the specified option to the connector.
/MD: select the multi-threaded and dll c run-time library.
/MDD: select the multi-thread, DLL, and debug C run-time libraries.
/Ml: select the single-threaded C run-time Library
/MLD: select the single-thread and debug C run-time libraries.
/MT: select the multi-threaded C run-time Library
/MTD: select the multi-thread and debug C run-time libraries.
/Nologo: do not display the copyright information of the program
/O1: optimize to minimize the number of executable codes generated
/O2: optimized to produce the fastest executable code
/OA: indicates that no alias is used in the compiler program, which can increase the execution speed of the program.
/Ob: controls the expansion of inline functions
/OD: code optimization prohibited
/OG: Use global optimization
/OI: use internal functions to replace function calls in the program, which can make the program run faster, but the program length becomes longer.
/OP: Improves the consistency of floating point comparison operations
/OS: Generate as little executable code as possible
/OT: generate executable code as much as possible.
/Ow: indicates that the compiler does not use aliases within the function body.
/Ox: Several optimization switches are combined to achieve as many optimization as possible.
/Oy: block the creation of frame pointers in the call stack
/Q1f: generates independent debugging information for core-level device drivers.
/Qi0f: Correct the Pentium 0x0f error command
/Qifdiv: Correct the incorrect Pentium fdiv command
/P: Write the pre-processing output to the specified file. The file suffix is I.
/TC: compile all the files on the command line as the C source program, regardless of whether the suffix is. c
/TC: Compile the specified file as a C source program, regardless of whether the suffix is. C.
/TP: compile all the files on the command line as the C ++ source program, regardless of whether the suffix is. cpp
/TP: Compile the specified file as a C ++ source program, regardless of whether the suffix is. cpp.
/U: Remove a specified previously defined symbol or constant.
/U: Remove all previously defined symbols or constants.
/V: the version number is embedded in the compiled OBJ file.
/VD: Disable/allow constructor replacement
/Vmb: select the pointer representation. Use this toggle to define the class before declaring a pointer to a member of a class.
/Vmg: select the pointer representation method. With this switch, you do not need to define this class before declaring a pointer to a member of a class, however, you must first specify the Inheritance Method Used for this class.
/Vmm: Set the pointer to single inheritance and multiple inheritance.
/VMS: Set the pointer to single inheritance.
/Vmv: sets the pointer to any class.
/W: Set the warning level
/W: Disable all warnings.
/X: prevents the compiler from searching for standard include directories.
/YC: Create a pre-compiled header file (PCH)
/Yd: Write complete debugging information in all OBJ files.
/YU: Use the specified precompiled header file during the build process.
/Yx: indicates that the compiler uses the precompiled header file if it exists. If it does not exist, it creates
/Z7: Generate debugging information compatible with msc7.0
/Za: Disable Language extension (Microsoft extensions to C)
/ZD: debugging information only contains the external and global symbol information and line number information
/Ze: Allow Language extension (Microsoft extensions to C)
/ZG: generates a function prototype for each function defined in the source file.
/Zi: Generate library files (PDB) and support edit and continue debugging features
/Zi: generate a library file (PDB) that contains type information and symbol debugging information
/ZL: remove the default library file name from the OBJ file
/ZM: sets the compiler's memory allocation Xianzhi
/Zn: Disable encapsulation in the information file.
/ZP: Set the Encapsulation Format of structure members in the memory.
/Zs: Quick syntax check
Tips
1)
Sometimes, during compilation, your computer suddenly shuts down illegally (maybe someone accidentally hits the power or your memory is unstable ). After you restart the machine, open the project, re-compile and send
Now VC will collapse. You may think that your VC compiler is broken, but it is not (you should try to compile other projects !), You only need to file the. NCB,. Opt,. APs,. CLW files of the project.
And delete all the files in the debug and release directories, and recompile them.
2)
If you want to share your source code project with others, but copying the entire project is too large. You can delete the following files:. DSW,. NCB,. Opt,. APs,. CLW ,.
PLG files and all files under the debug and release directories.
3)
When your workspace contains multiple projects, you may not be able to intuitively see which project is the current one. You can set it as follows: Tools->
Options-> Format, and then select workspace in category
Window to change its default font (for example, set it to fixedsys.
4) how to change the name of an existing project? Turn off the project. Open the. DSP file in text format and replace the original project name.
5)
Vc6 is useful for smart prompting of class members, but sometimes it fails. You can close the project, delete. CLW and. NCB, re-open the project, and click the menu item View>
Classwizard, click "add all" in the pop-up dialog box, and rebuild all again. Should be able to solve the problem