title: How can I control the way gcc/g++ automatically includes headers?
body: <p>I've run into trouble in the past when I've tried porting some C++ code written on Mac OS X to a Linux system, or trying to compile code written against an older version of gcc/g++ with a newer one:</p>
  
  <p>It seems that some (older?) versions of gcc/g++ would automatically include some header files for you.</p>
  
  <p>For example, code that uses <code>printf</code> should require <code>#include &lt;stdio.h&gt;</code>. And code that uses <code>memcpy</code> should require <code>#include &lt;string.h&gt;</code>. But depending on the version of gcc I'm using, it will occasionally include these for me.</p>
  
  <p>It wreaks havoc when I forget to include something and then <em>never get errors</em> until I go to compile the code on another system. At that point it's a game of running all over the project and fixing the includes.</p>
  
  <p>Has anyone else run into this? Is there a way to force gcc to autoinclude or to not autoinclude? Or, is there a way to know <em>what</em> it's autoincluding?</p>