BUG: Visual Workbench Makefile Does Not Produce Map File

ID: Q113424

1.00 1.50 MS-DOS kbtool kbbuglist

The information in this article applies to:

SYMPTOMS

A makefile generated by Visual Workbench fails to produce a map file when executed from the command line or as an external makefile. The map file is not generated even though the Create Map File option is set in the Linker Options and a map file is created when the project is built as a Visual Workbench internal makefile.

CAUSE

The makefile created by the Visual Workbench contains the following line:

   MAPFILE = nul

Even though the makefile uses the /MAP option on the link line, the nul MAPFILE field causes the map file not to be created.

The problem can be demonstrated by viewing the link step for the Microsoft Foundation Classes (MFC) Hello sample. Notice that the /MAP option is passed to the linker but the List File default filename, HELLO.MAP, is overridden with nul.

link /NOLOGO /NOD /PACKC:61440 /STACK:10240 /ALIGN:16 /ONERROR: NOEXE /MAP @HELLO.CRF

Object Modules [.obj]: /NOLOGO /NOD /PACKC:61440 /STACK:10240

                       /ALIGN:16 /ONERROR:NOEXE /MAP STDAFX.OBJ +
Object Modules [.obj]: HELLO.OBJ + Object Modules [.obj]: Run File [STDAFX.exe]: HELLO.EXE List File [c:HELLO.map]: nul Libraries [.lib]: C:\MSVC\LIB\+ Libraries [.lib]: C:\MSVC\MFC\LIB\+ Libraries [.lib]: mafxcw oldnames libw mlibcew commdlg.lib shell.lib Definitions File [nul.def]: HELLO.DEF;

RESOLUTION

The problem can be corrected by changing the MAPFILE line in the makefile to:

   MAPFILE =

This will force the linker to create a .MAP file with the same name as the project. You can also specify another name for the map file:

   MAPFILE = MYFILE.MAP

The makefile can be opened and manually changed as long as the project is not open in the Visual Workbench. The line remains changed until the project or project options are modified, at which time the nul is introduced back into the makefile. At that point, you must make the correction again before running the makefile from the command line or as an external makefile if a map file is desired. Permanently converting the makefile to an external makefile prevents the makefile from being set back to nul, but requires that the makefile be maintained manually.

Another option is to set the MAPFILE environment variable and use the /E switch (which specifies using the environment variable instead of the macro definition) when building the project, as in the following:

   SET MAPFILE = HELLO.MAP
   NMAKE /E /fHELLO.MAK

If you use the following format then you can set the MAPFILE environment variable just once for all projects (that is, it could be set in your AUTOEXEC.BAT file):

   SET MAPFILE=$*.MAP

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This is not a problem in Visual C++ 32-bit Edition.

Additional reference words: 1.00 1.50 file name make KBCategory: kbtool kbbuglist KBSubcategory: VWBIss Keywords : kb16bitonly

Last Reviewed: July 23, 1997