Conversion VC tool usage and debugging methods

Source: Internet
Author: User
Tags microsoft help

From: http://www.diybl.com/course/3_program/vc/vc_js/2007927/74892.html

 

 

How does VC ++ implement remote debugging?

* Assume that the IP address of the debugging machine is 192.168.0.182 and the remote IP address is 192.168.0.161.
* The remote machine assigns permissions to the debugging machine so that the debugging machine can log on to the remote machine using the Remote Desktop (this facilitates debugging ).
* Install Visual Studio. NET 2003 on the debug Machine
Share the remote debugging directory on Visual Studio on the debug machine (take my machine as an example)
C: \ Program Files \ Microsoft Visual Studio. NET 2003 \ common7 \ packages \ Debugger
* The remote machine saves the shared directory to the local machine, for example, D :\\ debugger.
* The debugging machine shares the directory of the program to be debugged, for example, D: \ important \ cvsroot \ DV-to-DVD \ bin \ debug.
* The remote machine copies the directory on the debugging machine as a local directory. For example, Z :\\
* Execute D: \ debugger \ msvcmon.exe-TCPIP-anyuser on the remote machine as a command line
* Start VC on the debugging machine. Open the project to be debugged. For example, dvtodvd. Select project> Properties
Select debuging-> remote setting.
Connection: Remote via TCP/IP (native only)
Remote machine: 192.168.0.161
Remote Command: Z: \ dvtodvd.exe
* Debug-> Start
* Debugging is now available.

1. 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.
2. 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 under the compiling conditions.
The release EXE file is linked to the Standard mfc dll (use MFC in a shared or static 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 is linked to the debug version of the mfc dll file and cannot be run on a machine without visual C ++ 6.0 installed, because the corresponding DLL is missing, unless you select use static DLL when link.

3. 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.
4. 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.
5. How to Use classwizard in a non-MFC Program
Create an empty. RC file in the project directory and add it to the project.
6. 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.
7. In the editing status, the member variables or functions cannot be displayed, 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
8. 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.
9. How to Find the classes that disappear in 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.
10. How to clear all breakpoints
Choose Edit> breakpoints ...], Open the breakpoints dialog box and click Remove all. The shortcut key is "Ctrl + Shift + F8 ".
11. 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.
12. 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.
13. 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.
14. 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.
15. 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.
16. How to quickly generate a new project with identical project names
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.
17. 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 the system prompts you 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.
18. 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.
Generally, there are two reasons for the error: one is that the referenced function or variable does not exist, the spelling is incorrect or the usage is incorrect; the other is that different versions of the Link Library may be used. The following are possible causes of lnk2001 errors:
<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 variable "var1" is attempted to access the change volume 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) When calling a function, if the parameter type used does not match the type declared in the header function, lnk2001 error will occur.
(4) lnk2001 error will occur when you attempt to call 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 are public. 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, these libraries will not be linked to the project file unless they are explicitly included in the file. In this case, using/nod will cause lnk2001 errors.
(2) If no program entry is set for wwinmaincrtstartup, the "unresolved external on _ winmain @ 16" lnk2001 error message will appear 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 libcmt. Lib is used, the lnk2001 error will occur on _ errno.
(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 (no inline keyword) is disabled in the header file that describes the function ), 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.
19. 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.
20. What do the project files in Visual C ++ 6.0 Project represent?
. Opt: parameter file of the project about the development environment. Such as the tool bar position and other information.
. APS (appstudio file) is a resource auxiliary file in binary format. You do not need to worry about it.
. 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 whether to re-create it each time you use classwizard.
. DSP (developstudio project): project file, text format, but do not modify it manually if you are not familiar with it.
. 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 (actually 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): It 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: 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. 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.

 

 

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.