title: Compiling my c++ program: clang: error: linker command failed with exit code 1 (use -v to see invocation)
body: <p>I am trying to execute below simple c++ program in mac. I installed c++ through Xcode Development ToolsBut getting error Linker Command Failed with exit code 1. How to fix it?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() 
  {
      cout &lt;&lt; "Hello World";
      return 0;
  };
  </code></pre>
  
  <p>Error Details are as follows</p>
  
  <pre><code>"std::__1::locale::use_facet(std::__1::locale::id&amp;) const", 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 hello-286e8d.o
    "std::__1::ios_base::getloc() const", 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 hello-286e8d.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 hello-286e8d.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:
        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 hello-286e8d.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 hello-286e8d.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 hello-286e8d.o
    "std::__1::cout", referenced from:
        _main in hello-286e8d.o
    "std::__1::ctype&lt;char&gt;::id", 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 hello-286e8d.o
    "std::__1::locale::~locale()", 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 hello-286e8d.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 hello-286e8d.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 hello-286e8d.o
    "std::terminate()", referenced from:
        ___clang_call_terminate in hello-286e8d.o
    "___cxa_begin_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 hello-286e8d.o
        ___clang_call_terminate in hello-286e8d.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 hello-286e8d.o
    "___gxx_personality_v0", 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 hello-286e8d.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 hello-286e8d.o
        Dwarf Exception Unwind Info (__eh_frame) in hello-286e8d.o
  ld: symbol(s) not found for architecture x86_64
  </code></pre>