title: Why can't I compile HelloWorld in C++?
body: <p>I'm trying to compile a simple Hello World program in C++ but I keep getting the following error...why?</p>
  
  <pre><code>gcc -o HelloWorldCompiled HelloWorld.cc
  /tmp/ccvLW1ei.o: In function `main':
  HelloWorld.cc:(.text+0xa): undefined reference to `std::cout'
  HelloWorld.cc:(.text+0xf): undefined reference to `std::basic_ostream&lt;char,     std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, char const*)'
  /tmp/ccvLW1ei.o: In function `__static_initialization_and_destruction_0(int, int)':
  HelloWorld.cc:(.text+0x3d): undefined reference to `std::ios_base::Init::Init()'
  HelloWorld.cc:(.text+0x42): undefined reference to `std::ios_base::Init::~Init()'
  /tmp/ccvLW1ei.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Here is my program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
    cout &lt;&lt; "Hello World\n";
  }
  </code></pre>