Microsoft KB Archive/93914

{| = PRB: /MAP Option on Compiler Command Line Ignored =
 * width="100%"|

ID: Q93914

The information in this article applies to:

The Microsoft C/C++ Compiler (CL.EXE) included with: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 6.0 and 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5

SYMPTOMS
In the Microsoft C and Microsoft QuickC compilers for MS-DOS, when the command line specifies both the /LINK and /MAP option switches, the compiler ignores the /MAP option.

The Microsoft C/C++ compiler for Windows NT does not have this problem because the supplied linker does not require comma delimited fields for the input.

CAUSE
The compiler places the /MAP switch on the linker command line after the map file specification.

RESOLUTION
Use the /Fm compiler option switch to create a map file.

MORE INFORMATION
To demonstrate this behavior with the MS-DOS version of the compiler, perform the following three steps:

1. Compile the code example below from either an MS-DOS prompt or an

OS/2 prompt using CL.EXE. Specify the /LINK and /MAP options after specifying the name of the C source file in the compiler command line, as follows:

cl test.c /link /MAP

Note the linker command line that the compiler generates. The Map File option lists NULL for the filename instead of the default map filename (in this example, TEST.MAP). The linker displays the following responses:

Object Modules [.obj]: test.obj Run File [test.exe]: &quot;test.exe&quot; /noi List File [nul.map]: NUL Libraries [.lib]: /MAP Definitions File [nul.def]: ;

Even though the /MAP option is specified for the linker process, The Linker does not generate a map file because the option is placed after the List File specification. 2. Compile the code example using the following command line: cl /Fm test.c

In this pass, the linker generates a map file. Because this command does not specify a filename, the command creates the TEST.MAP file (the base name TEST with the extension .MAP). 3. In Microsoft C/C++ version 7.0, the /MAP option can specify how much information the linker places in the map file. The two information options are /MAP:ADDRESS and /MAP:FULL. The ADDRESS option omits the list of public symbols in an application while the FULL option generates a full map listing. To generate a map file using one of these options, specify /MAP:ADDRESS or /MAP:FULL on  the compiler command line in addition to the /Fm option, as   follows:

cl /Fm test.c /link /MAP:FULL

In this case, the linker generates a MAP file with full symbolic information.

Sample Code
/* * Compiler options needed: /Fm or /link /MAP (see above) */


 * 1) include 

void main(void) {  int x;

printf(&quot;Hello world\n&quot;); } Additional reference words: 1.00 1.50 6.00 6.00a 6.00ax 7.00 8.00 8.00c 9.00 KBCategory: kbtool kbfasttip kbprb KBSubcategory: CLIss
 * }