title: Undefined symbol _main when trying to build shared library g++ / mac
body: <p>I am trying to build libdecodeqr on a mac.  My c++ building and linking history is all on windows, so it's an exciting journey of discovery.</p>
  
  <p>I have finally got to the point where I want to create the linked library.  The command I am running is:</p>
  
  <pre><code>g++ -shared -o libdecodeqr.so.0.9.3 bitstream.o codedata.o container.o ecidecoder.o formatinfo.o galois.o imagereader.o libdecodeqr.o -L/opt/local/lib -arch i386 -lcxcore -lcv
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>Undefined symbols:
      "_main", referenced from:
         start in crt1.10.5.o
  </code></pre>
  
  <p>I was under the impression that a creating a library using -shared flag meant I shouldn't need a main function.  There certainly isn't one in the source code.</p>
  
  <p>Just for kicks I added int main() {return 0;} to one of the cpp files and rebuilt.  The whole thing compiled and linked, but when I tried to use the output as a library I got errors telling me that I can't link to a main executable.  That makes sense I guess.</p>
  
  <p>Is there something else I need to pass to g++ to tell it to build a library?</p>