title: C++ Compilation and File Size
body: <p>I've Googled this, but most of the results are about compiler A vs. compiler B. </p>
  
  <p>This question arises from my experience with Web Design (know the languages commonly used on Web Design aren't compiled. CGI is an exception.) When you include file in a web page the entire file is downloaded to the user's computer. If you use JQuery, a JavaScript library, you must include JQuery in the <code>&lt;head&gt;</code> in order to use its functions. This got me thinking about C++ compilers.</p>
  
  <p>In C++ it's practically impossible to program without <code>#include &lt;library&gt;</code>. Are the libraries compiled along with the project files? Is the</p>
  
  <p>For example, in this simple Hello Word program <code>#include &lt;iostream&gt;</code>, is all of the code in the iostream header file compiled? Will taking ONLY the code that defines <code>cout</code> and adding it to this example make the size of the file smaller? Does compiler optimization take care of only compiling the necessary code from <code>iostream</code>?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
     std::cout&lt;&lt;"Hello World.";
     return 0;
  }
  </code></pre>