Microsoft KB Archive/116419

From BetaArchive Wiki
Knowledge Base


FIX: Conditional Directives Ignored by Dependency Scanning

Article ID: 116419

Article Last Modified on 8/16/2005



APPLIES TO

  • Microsoft Visual Workbench for Windows
  • Microsoft Visual C++ 1.5 Professional Edition
  • Microsoft Visual C++ 1.0 Professional Edition



This article was previously published under Q116419

SYMPTOMS

Conditional compilation directives (#if, #endif, and so forth), put in so that you can selectively include header files within a source file, are handled inconsistently by the .MAK file dependency generator when it writes the .MAK file for a project.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 2.0

MORE INFORMATION

The following steps can be used to reproduce this problem:

  1. Create the following two files (assume the files JUNK.H and \TMP\JUNK.H do not already exist):

          //---------------------
            // main.cpp
            //---------------------
            #undef SOMETHING
            #include "test.h"
    
            //---------------------
            // test.h
            //---------------------
            #if defined (SOMETHING)
            #include <junk.h>
            #include <\tmp\junk.h>
            #endif
                            
  2. Create a new project for an MS-DOS or console application using the Visual WorkBench.
  3. Add MAIN.CPP to the project dependencies from the dialog box you get by choosing Edit from the Project menu.
  4. Open the .MAK file you created and look for the section describing the dependencies for MAIN.CPP. (In Visual C++, version 1.5, the Visual WorkBench creates a macro called MAIN_DEP to keep track of the dependencies.) Notice that there is a dependency on TEST.H (which is correct) and that there is no dependency on JUNK.H (which is also correct), but that there is a dependency on \TMP\JUNK.H (which is incorrect).



Additional query words: 1.00 1.50 1.10 S_VWB

Keywords: kbbug kbfix kbide KB116419