title: GCC linker can't find standard library?
body: <p>I've been developing a school project in XCode. The final product has to be submitted in source code with a makefile, so I wrote a makefile and to start compiling that way, to make sure I had a working copy. Here's my makefile:</p>
  
  <pre><code>all: main.o StackList.o world.o Farm.o
          gcc main.o StackList.o world.o Farm.o -g -o Project1
  
  main.o:
          gcc -g -c main.cpp
  
  StackList.o:
          gcc -g -c Stacklist.cpp
  
  world.cpp:
          gcc -g -c world.cpp
  
  Farm.cpp:
          gcc -g -c Farm.cpp
  
  clean:
          rm *.o Project1
  </code></pre>
  
  <p>Compiling each of the object files works fine, but when it gets to "all," the linking step, it appears to not be aware of the standard library. I get "undefined symbols" error for everythin from "cin", to "basic_string", to "operator new".</p>
  
  <p>I was under the impression that these things didn't need to be indicated directly, and in fact have not needed to do so in the past.</p>
  
  <p>Any idea what might be happening?</p>
  
  <p>EDIT:</p>
  
  <p>If it helps, here's the start of the (very long) error message:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "std::cin", referenced from:
    _main in main.o
    "std::cout", referenced from:
        _main in main.o
        Farm::print(int)  in Farm.o
    "std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)", referenced from:
        _main in main.o
    "std::ios_base::Init::Init()", referenced from:
        __static_initialization_and_destruction_0(int, int)in main.o
        __static_initialization_and_destruction_0(int, int)in StackList.o
        __static_initialization_and_destruction_0(int, int)in world.o
        __static_initialization_and_destruction_0(int, int)in Farm.o
    "std::ios_base::Init::~Init()", referenced from:
        ___tcf_0 in main.o
        ___tcf_0 in StackList.o
        ___tcf_0 in world.o
        ___tcf_0 in Farm.o
    "operator new(unsigned long)", referenced from:
        doStackSearch(std::basic_istream&lt;char, std::char_traits&lt;char&gt; &gt;*, std::list&lt;Farm*, std::allocator&lt;Farm*&gt; &gt;*&amp;)in world.o
  </code></pre>