RESOLUTION
By 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 Files
Similarly, 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:
- CL.EXE is executed with /Fr or /FR, and without the /Zn option,
regardless of whether BSCMAKE is executed with the /Iu option.
Omitting the /Zn option causes browser file packing to discard
information about unreferenced symbols.
- CL.EXE is executed with /Fr or /FR, and /Zn, and BSCMAKE is executed
without the /Iu option. Omitting the /Iu option causes BSCMAKE to
ignore information about unreferenced symbols.
In order for the solutions presented here to work, both of these must be
true:
- The Compiler must be executed with /Fr or /FR, and /Zn.
- BSCMAKE must be executed with the /Iu option in the same build.