1. How to quickly standardize the code indent format
Select the required code and press SHIFT + F8
2. How to debug in the release status
Project-> setting => projectsetting dialog box, select the release status. In the C/C ++ label, select general for category, disable (Debug) for optimizations, and program database for debut info. Select the Generate debug info check box in the Link label.
Note: It is only an intermediate state between debug and release, and all assert and verify do not work. The function call method is actually called, rather than the table, however, in this status, the quickwatch and call queue tracking functions are still effective, just like the debug version.
3. What is the difference between release and debug.
The release version is called the release version, and the debug version is called the debug version.
Debug can be executed and tracked in one step, but the generated executable file is relatively large, and the code runs slowly. Release runs fast and has a small executable file, but cannot execute the debugging function when its compilation conditions are low.
The release EXE file is linked to the Standard mfc dll (use MFC in a shared or static DLL), such as mfc42.dll. These DLL have been configured during Windows installation, so these programs can run on machines without visual C ++ 6.0 installed. The debug version EXE links the debug version of the mfc dll file, such as mfc42d. dll. Cannot run on a machine without visual C ++ 6.0 installed, because mfc42d. dll is missing, unless you select use static DLL when link.
4. What is the difference between assert and verify?
The content in assert is not compiled in the release version. Verify still translates the content, but does not judge whether the content is true or false. Therefore, the latter is safer.
For example, assert (file. Open (strfilename )).
Once in the release version, this line is ignored, and the file is not open () at all, and there is no error message. If verify () is used, this problem will not occur.
5. What is the relationship between workspace and project?
Each workspace can contain several projects, but only one of them is in the active state. Each project can have dependencies .. for example, the active project can depend on other static libraries that provide function calls.
6. How to Use classwizard in a non-MFC Program
Create an empty. RC file in the project directory and add it to the project.
7. How to set breakpoints
Press F9 to add a breakpoint and cancel a breakpoint at the current cursor.
In addition, press Ctrl + B to bring up the breakpoint Settings dialog box. Then click [condition ...] Click the button to bring up a dialog box to set the breakpoint conditions.
8. The member variables or functions cannot be displayed in the editing status, prompting you how to enable the display function.
This seems to be a bug in the current visual c ++ 6.0 version. You can follow the steps below to make it normal. If it appears again, it can be processed as follows:
(1) Close the project
(2) Delete the "Project name. NCB" File
(3) re-open the project
9. How to completely delete a class generated by classwizard
First, select. H and. to delete the CPP file, press delete to delete it, delete the two files in the file manager, and then run classwizard. If you want to remove the files, select Remove.
10. How to find out the classes that disappear from the workspace?
Open the header file corresponding to the class, and change its class name. A new class will appear in the workspace, and then change the class to its original name.
11. How to identify all breakpoints
Choose Edit> breakpoints ...], Open the breakpoints dialog box and click Remove all.
The shortcut key is "Ctrl + Shift + F8 ".
12. How to Select Unlisted Information in classwizard?
Open the "classwizard" dialog box and switch to the "class Info" page. Change "message filter". For example, if "window" is selected, window information will appear on the "message" page.
13. How to check whether parentheses in the program match
Move the cursor to the bracket to be checked and press the shortcut key Ctrl +]. If the brackets match correctly, the cursor jumps to the matching brackets. Otherwise, the cursor does not move and the chassis horn generates a warning.
14. How to view the definition of a macro (or variable or function)
Move the cursor to a macro to be viewed. For example, on the most common declare_map_message, click F12 (or right-click the relevant menu in the menu). If a Browser file is not created, a prompt dialog box is displayed, click OK, and the macro (or variable, function) will jump to the defined place.
15. How to add a lib file to the current project
Choose project> Settings ...] In the displayed "project setting" dialog box, switch to the "Link" tab, enter the Lib file name in "Object/library modules", and use a blank space for different lib files.
16. How to quickly delete temporary files in the debug folder of a project
In the FileView view of the workspace, select the corresponding project, right-click the pop-up menu, and select the clean (selection only) menu.
17. How to quickly generate a new project with the same name as the existing project.
In the new project dialog box, select Custom Appwizard, enter the name of the new project, and click OK. The custom Appwizard item appears. enter the name of the new project and click OK. In the custom Appwizard-step 1 of 2 dialog box, select an existing project and click Next. The custom Appwizard-Step 2 of 2 dialog box appears. Select the project file name of the existing project and click Finish. After compilation, a project Appwizard that is the same as the existing project but can be renamed again is generated.
Now you can use the customized Wizard like the MFC Appwizard. If you do not want to use it, you can delete the. awx and. PDB files corresponding to the wizard in the common \ msdev98 \ template directory under the Visual C ++ 6.0 installation directory.
18. How to Solve the Problem of incorrect connection to Visual C ++ 6.0
Scenario: if a file is changed, the entire project must be re-compiled and linked once. Just now the link is ready for operation, and a prompt is displayed to re-compile the link once.
This is because of the future file (the modification time and creation time are later than the system time. You can do this: Find the DEBUG directory under the project folder, delete all files created and modified at a time later than the system time, and then rebuild all again.
19. What are common errors that cause lnk2001?
The main lnk2001 error is: unresolved external symbol "symbol"
This error message is returned if the linked program cannot find the referenced function, variable, or tag in all libraries and target files.
In general, there are two reasons for the error: the function or variable referenced at the moment does not exist, the spelling is incorrect, or the usage is incorrect. The Link Library of different versions may be used. Here is the possible cause of lnk2001 error:
<1> lnk2001 error caused by an Encoding Error
(1) mismatched program code or module definition (. Def) file causes lnk2001. For example, if a variable "var1" is declared in the C ++ source file, but the view accesses the change volume with the variable "var1" in another file.
(2) If the inline function is defined in the. cpp file, rather than being defined in the header file, lnk2001 errors will occur.
(3) call a function. If the declared type of the parameter Type header is incorrect, the lnk2001 error will occur.
(4) lnk2001 errors will occur when a view calls a virtual function from the constructors or destructor of the base class.
(5) Pay attention to the availability of functions and variables. Only global variables and functions can be shared. Static functions and static variables have the same scope of use. A compilation error or lnk2001 error occurs when you try to obtain any static variables not declared in the file from outside the file.
<2> lnk2001 errors caused by compilation and connection settings
(1) If the/nod (/noderaultlib) option is used during compilation, the Runtime Library and MFC required by the program will be written into the target file module by the compiler, however, unless the library names are explicitly included in the file, these libraries will not be linked to the project file north. In this case, using/nod will cause lnk2001 errors.
(2) If no program entry is set for wwinmaincrtstartup, The lnk2001 error message "unresolved external on _ winmain @ 16" is reported when Unicode and MFC are used.
(3) When compiling with the/MD option, since all the runtime libraries are kept in the dynamic link library, reference "_ imp _ FUNC" in the target file. If you try to use the static library libc. lib or libcmt. Lib for Link, lnk2001 error will occur on _ imp _ FUNC. If you do not use the/MD option for compilation, the lnk2001 error will also occur when you use the msvcxx. Lib link.
(4) When compiling with the/ml option, if you use libcmt. lib to link back to _ errno, The lnk2001 error occurs.
(5) When compiling and debugging an application, if you use the release modal library for link, the lnk2001 error will also occur. Similarly, the same error occurs when you use the debug modal library to link the release application.
(6) mixed use of libraries and compilers of different versions can also cause problems, because the new library may contain symbols and descriptions not available in earlier versions.
(7) using inner and non-inline compilation options in different modules can cause lnk2001 errors. If function inline (/ob1 or/ob2) is enabled when the C ++ library is created, but function inline is disabled in the corresponding header questionnaire about the function (no inline keyword ), only the error message is returned. To avoid this problem, the inline keyword should be marked as an inline function in the corresponding header file.
(8) Incorrect/subsystem or entry settings can also cause lnk2001 errors.
20. How to debug a DLL called by an EXE file without source code
In Visual C ++ 6.0, go to the project Setting Dialog Box and select the debug tab. Generally, Visual Studio uses "executable for debug session" by default as the executable file name, but you can change it to any program you want. You can even specify different working directories and PASS Parameters to your program. This technique is often used to debug DLLs, namespace extensions, COM objects, and other plug-in programs called from certain EXE and third-party exe.
21. What are the project files in the Visual C ++ 6.0 Project.
. Opt: parameter file of the project about the development environment. Such as the tool bar position and other information.
. APS (appstudio file) Resource auxiliary file in binary format.
. CLW: classwizard information file, which 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 whether to re-create it each time you use classwizard.
. DSP (developstudio project): project file, text format, but unfamiliar or do not modify it manually.
. DSW (developstudio workspace): It is a workspace file. Other features are similar to. DSP.
. PLG: it is a compilation information file. The error and warning information files during compilation (in fact, an HTML file) are generally of little use. In the dialog box that appears, choose tool> Option to control file generation.
. HPJ (Help Project): a project that generates a Help file, which can be processed by Microsoft Help compiler.
. MDP (Microsoft devstudio project): an earlier version of the project file. If you want to open this file, a message is returned asking if you want to convert it to a new. DSP format.
. Bsc: Used to browse project information. If source Brower is used, the file must be added again. If you do not need this function, you can remove generate browse inf from project options.
O file to speed up compilation.
. Map is the image information record file of the execution file. This file is generally not required unless it is at the underlying level of the system.
. PCH (pre-compiled file): it is used to compile files, which can speed up compilation, but the file size is very large.
. PDB (Program database) Records Program-related data and debugging information, which may be useful during debugging.
. Exp: it is generated only when the DLL is compiled. It records some information about the DLL file and is generally useless.
. NCB: no compile browser ). You can delete this file when the Automatic completion function fails. The project is automatically generated after compilation.