Troubleshooting for the Microsoft Visual C++ Compiler or the Visual C++ Linker (134650)
The information in this article applies to:
- Microsoft Visual C++ 1.0
- Microsoft Visual C++ 2.0
- Microsoft Visual C++ 2.1
- Microsoft Visual C++ 2.2
- Microsoft Visual C++ 4.0
- Microsoft Visual C++ 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q134650 SUMMARY When you investigate a possible problem with the Microsoft
Visual C++ compiler or linker, it is important to obtain as much information as
possible about the build process and the options being used. This article
discusses some trouble-shooting tips to help you resolve your build problem.
MORE INFORMATIONCompiler Problems For compiler problems, such as internal compiler errors (for
example, C1001), hangs, or crashes, use the /P switch to obtain additional
compiler information.
The /P compiler switch directs CL.EXE to send preprocessor
output to a file. The preprocessor output file (with an extension of .i) has
the same name as the file being compiled and is created in the same directory.
Note that the build will not continue past the preprocessor phase when using
this switch. You can compile the preprocessor output file by itself
outside of the context of a project. The file contains all of the header file
code, macro replacement, and preprocessed compiler directive information needed
for the compilation of that particular .C or .CPP source file. The resulting
file will often be long and contain a large amount of white space.
Alternatively, you can use the /EP and /E compiler switches, which direct
CL.EXE to send preprocessor output to the standard output device.
Link Problems For linker problems (LNKxxxx type errors), you can use the
LINK_REPRO environment variable to reproduce the problem:
- Open up an MS-DOS session.
- Set LINK_REPRO to point to an existing and empty directory,
for example:
SET LINK_REPRO=C:\TESTPROB
- Run the linker in the same MS-DOS session where the
variable was set.
- Run the VCVARS32.BAT file from the Visual C++ BIN directory
to set the compiler environment variables.
- Change to your project directory, and run NMAKE to rebuild
your project, using this command:
The /a option directs NMAKE to perform a complete rebuild of the
project. When LINK.EXE is invoked, it will copy everything it needs
to link your project into the directory specified by the LINK_REPRO environment
variable. Among the files copied will be your object files (*.OBJ), required
library files (*.LIB), including Microsoft libraries, and a linker response
file (LINK.RSP), so that LINK is no longer dependent on your project makefile.
This feature is also available from the IDE if it has been run from
an environment where the LINK_REPRO variable has been set. To
confirm that you have all the necessary files to reproduce the link problem,
you can run LINK in the directory specified by the LINK_REPRO environment
variable, using the linker response file: Use the following command to switch off this feature: You can also use the LINK_REPRO environment variable to verify
the files involved in creating a library, when using LIB.EXE or LINK /LIB.
Modification Type: | Major | Last Reviewed: | 4/28/2005 |
---|
Keywords: | kbtshoot kbinfo kbArtTypeINF kbCompiler kbCPPonly KB134650 kbAudDeveloper |
---|
|