PRB: /MAP Option on Compiler Command Line Ignored

Last reviewed: November 2, 1995
Article 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]: "test.exe" /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.

    1. 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).

    2. 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)
     */
    
    #include <stdio.h>
    
    void main(void)
    
    {
       int x;
    
       printf("Hello world\n");
    
    }


  • 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


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: November 2, 1995
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.