Monday 25 March 2013

Why is this header being included?

Often I'll find a visual studio project not compiling as a header file generates an error. Then I realise there's no need for that header to be needed as it's totally unrelated.
So why is it being included?
It can take a lot of guesswork to track down the reason in a large project, but here's a quick method of showing the whole header tree for a cpp.

Add "/ShowIncludes" to the command line options for that cpp. A recursive list is displayed of each included file. Hopefully an unnecessary header file can be identified to enable this tree to be pruned.

Alternatively set the compile option:
http://msdn.microsoft.com/en-us/library/hdkef6tk(v=vs.80).aspx

No comments:

Post a Comment