Here’s a short cheat sheet summarizing an internal talk I gave a while ago about VC++ build diagnostics. These switches and tools are all documented, most are surveyed in previous posts here, and all are very useful when struck by baffling build/load errors.
Stage | Diagnostic Tool |
Solution / project configuration | Tools/ Options/ Projects and Solutions/ Build and Run/ MSBuild output verbosity – Diagnostic |
Includes | Project Properties/ configuration /C-C++/ Advanced/Show Includes – Yes |
Preprocessor | Project Properties/ configuration /C-C++/ Preprocess to a File – Yes |
Compiler output, obj or lib | VS command prompt – “Dumpbin /ALL YourBin.lib > YourOutput.txt” optionally undname on relevant names in the result |
Linkage | Project Properties/configuration/Linker/Show Progress – VERBOSE |
Complete binary | Dependency Walker |
Loader | Gflags / ShowSnaps |
When in doubt | Process Monitor |
To use this effectively you must first define the exact stage where the failure occurs (which isn’t always trivial), then use the listed switch/tool.
Specifically Process Monitor is useful in multiple contexts – but mostly when you suspect used file is being consumed from an erroneous location. I recommend not adding a process name filter, as multiple processes are typically involved – devenv.exe, MSBuild.exe, cl.exe, link.exe, mspdbsvr etc. For header files there’s /ShowIncludes and for dll’s there’s link /verbose or Gflags/ShowSnaps, but many other files are consumed and have potential for errors (property sheets, resources, etc.) and ProcessMonitor covers them all.
Enjoy.