2

I'm working with a program, full of compiler directives, programmed in Visual Studio.

I've made some changes and now I'm stuck with an unresolved external compiler/linker error.

I believe this is caused by the compiler directives, which seem not to detect the implementation of that particular function, and in order to investigate this, I'd like to follow the #ifdef compiler directives throughout the compilation process.

I've already tried using the /P configuration, but I don't see any compiler directive in the Output window.

Does anybody know how to do this?

Dominique
  • 16,450
  • 15
  • 56
  • 112
  • Visual Studio should grey out blocks of code disabled by macros, no? – DeiDei Apr 19 '17 at 14:24
  • Indeed, but this is only useful in case of static compiler directives, but in my case sometimes they start with a `#define`, then an `#undefine` is done, and then back again, ..., and I'm loosing myself in it (hence most probably the unresolved external), and I'm hoping that the compilation output of the preprocessor can show me what's going on. – Dominique Apr 19 '17 at 14:27

1 Answers1

1

I think you're on the right track with the /P option, but the doc states that the output will go to files with a .i extension (so probably not to your Output window).

Further, you may be able to find some help on any linker errors by generating a map file; see /MAP (Generate Mapfile).

Phil Brubaker
  • 1,257
  • 3
  • 11
  • 14
  • Does the output window show the compiler command being executed? There may be some clues there why the file(s) aren't being generated. – Phil Brubaker Apr 19 '17 at 14:53
  • I just tried enabling the `/P` option on a simple console app and built. The `.i` file lands in the build output directory (e.g., `Debug` in my case). The link fails as a side effect (so you'd troubleshoot problems there after you troubleshoot the compiler/preprocessor issues). – Phil Brubaker Apr 19 '17 at 15:02