3

When there's a build error in a header file included by a series of include files from a .cpp file, how do I make visual studio show the whole chain of include files?

For example,

fatal error C1083: Cannot open include file: 'abc.h': No such file or directory

I'd like it to also print something like

included from 'xyz.h', included from 'efg.h', included from 'main.cpp'
gsamaras
  • 71,951
  • 46
  • 188
  • 305
neckutrek
  • 353
  • 2
  • 14
  • 1
    @Evg It is not really a duplicate because this question asks about printing include chain, rather than complete hierarchy. – user7860670 Nov 07 '18 at 09:07
  • @user7860670 is correct, there is a fundamental difference in asking "includes what", and "included by what" – Otzen Feb 25 '20 at 12:34

1 Answers1

4

You can use /showIncludes option, it can be found at C/C++ -> Advanced section. It will dump a complete include tree though.

gsamaras
  • 71,951
  • 46
  • 188
  • 305
user7860670
  • 35,849
  • 4
  • 58
  • 84
  • Under `Tools->Options->C/C++->Advanced` there's no option called `Show Includes` in VS2015. Can I look elsewhere? – neckutrek Nov 07 '18 at 09:02
  • Found it. There's a duplicate post here: https://stackoverflow.com/questions/1137966/displaying-the-include-hierarchy-for-a-c-file-in-visual-studio?rq=1 – neckutrek Nov 07 '18 at 09:03