PRB: Unreferenced Symbols Don't Appear in .BSC FileLast reviewed: July 31, 1997Article ID: Q121289 |
1.00 1.50 1.51 | 1.00
WINDOWS | WINDOWS NTkbusage kbtool kbprb The information in this article applies to:
- Microsoft Visual C++ for Windows, versions 1.0, 1.5, and 1.51 - Microsoft Visual C++, 32-bit Edition, version 1.0
SYMPTOMSUnless a symbol is referenced in a program, it will not appear in the browser database.
CAUSEThis problem is due to the default behaviors of the Compiler (CL.EXE) and how it handles browser files (.SBR files), as well as the Browser Database Maintenance Utility (BSCMAKE.EXE) and how it handles browser databases (.BSC files). NOTE: This article does not apply to Microsoft Visual C++, 32-bit Edition, version 2.0 and above. In these versions, when the compiler option "Don't Pack Info" is selected, the option /Zn is added to the CL compile line. Subsequently, the option /Iu is automatically added to BSCMAKE.EXE.
RESOLUTIONBy understanding the default behaviors, you can discover where unreferenced symbols are defined. The default behavior of the Compiler when using the /FR or /Fr switches is to pack browser files, removing information about where unreferenced symbols are defined. To prevent the Compiler from doing this packing, use the /Zn switch from the command line, or check the "Don't Pack Information" checkbox under:
Options...|Project...|Compiler...|Listing FilesSimilarly, the default behavior of BSCMAKE is to not record information about unreferenced symbols when building the browser database for an application. To turn off this behavior, use the /Iu switch from the command line. NOTE: There is no way to control BSCMAKE's behavior when using a Visual Workbench-generated makefile. The hard-coded default BSCMAKE command line used by the Visual Workbench doesn't include the /Iu option. In the case of a Visual Workbench-generated makefile, find the inference rule within the makefile generated by the Visual Workbench that causes the BSCMAKE utility to be executed. There, change the command line that is passed to the BSCMAKE utility. To do this, open the makefile as a text file and find the $(PROJ).BSC: inference rule. You should see the BSCMAKE command on the next line or two. Just add the /Iu option as shown in this example: $(PROJ).BSC: $(SBRS) bscmake@<</Iu /o$@ $(SBRS) << NOTE: There is an important caveat here. When you use the internal build engine of the Visual Workbench, the inference rule portion of the makefile is not used. Instead, the Visual Workbench uses the inference rules only when the file is opened as an external makefile. For this solution to work, the makefile must be opened as an external makefile in the Visual Workbench or the project must be built with NMAKE from the command line. NOTE: The Compiler and BSCMAKE work independently. BSCMAKE builds the browser database from browser (.SBR) files generated at compile time. Unreferenced symbols will not appear in the browser database if:
MORE INFORMATIONAn unreferenced symbol is a symbol that has been defined, but never appears in the body of code apart from its definition. Common examples of defined but unreferenced symbols are instances of CWinApp-derived classes in MFC applications and variables of any type that are not used in an application.
|
Additional reference words: 1.00 1.50 1.51
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |