title: Compiling a C++ program with GCC
body: <p>How can I compile a C++ program with the GCC compiler?</p>
  <h3>File <em>info.c</em></h3>
  <pre><code>#include&lt;iostream&gt;
  using std::cout;
  using std::endl;
  
  int main()
  {
     #ifdef __cplusplus
     cout &lt;&lt; &quot;C++ compiler in use and version is &quot; &lt;&lt; __cplusplus &lt;&lt; endl;
     #endif
     cout &lt;&lt;&quot;Version is &quot; &lt;&lt; __STDC_VERSION__ &lt;&lt; endl;
     cout &lt;&lt; &quot;Hi&quot; &lt;&lt; __FILE__ &lt;&lt; __LINE__ &lt;&lt; endl;
  }
  </code></pre>
  <p>And when I try to compile <code>info.c</code>:</p>
  <p><code>gcc info.C</code></p>
  <pre class="lang-none prettyprint-override"><code>Undefined                       first referenced
   symbol                             in file
  cout                                /var/tmp/ccPxLN2a.o
  endl(ostream &amp;)                     /var/tmp/ccPxLN2a.o
  ostream::operator&lt;&lt;(ostream &amp;(*)(ostream &amp;))/var/tmp/ccPxLN2a.o
  ostream::operator&lt;&lt;(int)            /var/tmp/ccPxLN2a.o
  ostream::operator&lt;&lt;(long)           /var/tmp/ccPxLN2a.o
  ostream::operator&lt;&lt;(char const *)   /var/tmp/ccPxLN2a.o
  ld: fatal: Symbol referencing errors. No output written to a.out
  collect2: ld returned 1 exit status
  </code></pre>
  <p>Isn't the GCC compiler capable of compiling C++ programs?
  On a related note, what is the difference between <code>gcc</code> and <code>g++</code>?</p>