gcc main.cpp -o main.out not working
<p>when I run: 'gcc getline.cpp -o main.out' it fails and gives a really long error message. The program compiles and runs with 'make getline' then './getline'. I'm fairly certain that i have gcc installed because when i just type gcc it gives me the error message 'clang: error:no input files'. Also for reference I'm running OSX Yosemite 10.10.5 although I don't think that is playing a factor. Here is the code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

 int main ()
{
  std::string mystr;
  std::cout &lt;&lt; "What's your name? ";
  std::getline (cin, mystr);
  std::cout &lt;&lt; "Hello " &lt;&lt; mystr &lt;&lt; ".\n";
  std::cout &lt;&lt; "What is your favorite team? ";
  std::getline (std::cin, mystr);
  std::cout &lt;&lt; "I like " &lt;&lt; mystr &lt;&lt; " too!\n";
  return 0;
}
</code></pre>

<p>Here is the error message that prints out:</p>

<pre><code>Undefined symbols for architecture x86_64:
  "std::__1::locale::use_facet(std::__1::locale::id&amp;) const", referenced from:
      _main in getline-5b273e.o
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
  "std::__1::ios_base::getloc() const", referenced from:
      _main in getline-5b273e.o
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
  "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::__init(unsigned long, char)", referenced from:
      std::__1::ostreambuf_iterator&lt;char, std::__1::char_traits&lt;char&gt; &gt; std::__1::__pad_and_output&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::ostreambuf_iterator&lt;char, std::__1::char_traits&lt;char&gt; &gt;, char const*, char const*, char const*, std::__1::ios_base&amp;, char) in getline-5b273e.o
  "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::push_back(char)", referenced from:
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
  "std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::~basic_string()", referenced from:
      _main in getline-5b273e.o
      std::__1::ostreambuf_iterator&lt;char, std::__1::char_traits&lt;char&gt; &gt; std::__1::__pad_and_output&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::ostreambuf_iterator&lt;char, std::__1::char_traits&lt;char&gt; &gt;, char const*, char const*, char const*, std::__1::ios_base&amp;, char) in getline-5b273e.o
  "std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;::sentry::sentry(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, bool)", referenced from:
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
  "std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;::sentry::sentry(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;)", referenced from:
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
  "std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;::sentry::~sentry()", referenced from:
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
  "std::__1::cin", referenced from:
      _main in getline-5b273e.o
  "std::__1::cout", referenced from:
      _main in getline-5b273e.o
  "std::__1::ctype&lt;char&gt;::id", referenced from:
      _main in getline-5b273e.o
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
  "std::__1::locale::~locale()", referenced from:
      _main in getline-5b273e.o
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in getline-5b273e.o
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in getline-5b273e.o
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
  "___cxa_end_catch", referenced from:
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
  "___gxx_personality_v0", referenced from:
      _main in getline-5b273e.o
      std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::__put_character_sequence&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*, unsigned long) in getline-5b273e.o
      std::__1::ostreambuf_iterator&lt;char, std::__1::char_traits&lt;char&gt; &gt; std::__1::__pad_and_output&lt;char, std::__1::char_traits&lt;char&gt; &gt;(std::__1::ostreambuf_iterator&lt;char, std::__1::char_traits&lt;char&gt; &gt;, char const*, char const*, char const*, std::__1::ios_base&amp;, char) in getline-5b273e.o
      std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::getline&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;&amp;, char) in getline-5b273e.o
      Dwarf Exception Unwind Info (__eh_frame) in getline-5b273e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1
</code></pre>