Wednesday 17 January 2018

Displaying the #include hierarchy for a C++ file in Visual Studio

itemprop="text">

Problem:
I have a large Visual C++ project that I'm trying to migrate to Visual Studio 2010. It's
a huge mix of stuff from various sources and of various ages. I'm getting problems
because something is including both winsock.h and
winsock2.h.



Question:
What tools and techniques are there for displaying the #include
hierarchy for a Visual Studio C++ source file?



I
know about cl /P for getting the
preprocessor output, but that doesn't clearly show which file includes which other files
(and in this case the /P output is
376,932 lines long 8-)



In a perfect world I'd
like a hierarchical display of which files include which other files, along with line
numbers so I can jump into the
sources:




source.cpp(1)

windows.h(100)
winsock.h
some_other_thing.h(1234)

winsock2.h

class="post-text" itemprop="text">
class="normal">Answer



There is a
setting:



Project Settings -> Configuration
Properties -> C/C++ -> Advanced -> Show
Includes




that will generate the tree.
It maps to the compiler switch href="https://docs.microsoft.com/en-us/cpp/build/reference/showincludes-list-include-files?view=vs-2019"
rel="nofollow noreferrer">/showIncludes



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...