So I have below code in my file mine.cpp,
#include <iostream>
#define max INT_MAX
The identifier "INT_MAX" will be undefined if I remove "#include <iostream>". So, I know it is defined somewhere in iostream.
When I go to the definition of INT_MAX it is in limits.h file. So, I guess limits.h is nested include in iostream.
Is there a way for me to view (like mine.cpp->iostream->...->limits.h) how limits.h is included in my mine.cpp without building.
I searched and found there are other similar questions but all answers related to them include "build with some option". I have to do this without building as my build takes quite some time to complete.
That's a strange requirement:
without building.
What exactly are you trying to avoid? Building the entire project/solution? To save time?
As noted by @dxiv and @Boris, you need to at least compile that file. More strictly - run a pre-processor on it to expand macros, conditional compilation, etc.
Compiling you file with /showIncludes
and /P
(preprocess to a file) technically doesn't "build", as the object file is not produced.
The generated output is hierarchical, so you get a complete path of inclusion.
You didn't mention the version and edition of your Studio; this post Generate graph of include files in Visual Studio Community 2019 states that Enterprise edition of 2019 (and possible 2017) has "Generate Graph Of Include Files"
feature. However, the process that it is using likely involves compiling or preprocessing :)