« SIGGRAPH 2008 | Home | BigDog (Beta) »

Individual Entry With Comments

March 23, 2008

Visual Studio Gem #1 - Include Files

Filed under Programming

Tracking down how an include file (.h) got into your project can be painful.

It's obvious if the include file is #include'ed by one of your files. It's less obvious when the include file is brought in by nested includes. Also, some include files are enclosed in #ifdef XXXX/#endif which requires knowledge of macro XXXX in order to determine if this code path is actually used.

There's a better way!

Go to...

Microsoft Visual Studio->Project->Properties...->Configuration Properties->C/C++->Advanced->Show Includes

Set this option to "Yes."


When you compile your files, the Output window will show you:

  • Every include file
  • The order include files are parsed
  • The parent include file via indentation


For example, in the above Output window, stdafx.h brings in targetver.h and windows.h. Windows.h brings in sdkddver.h and excpt.h.

Here's what stdafx.h looks like for reference...


You don't want this option on all the time because it will really pollute your output window and slow things down with massive amounts of information.

This setting can also be helpful in determining what include files should be part of your precompiled headers.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


This page contains a single entry from the blog posted on March 23, 2008 11:01 AM.

The previous post in this blog was SIGGRAPH 2008.

The next post in this blog is BigDog (Beta).

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34