title: Why is OSX skipping symbols during linking - Undefined symbols for architecture x86_64
body: <p><strong>UPDATE</strong> when I switch from "g++" to "c++" everything compiles and links fine.  It's my understanding both of those map to clang, so I'm not sure what the difference is.</p>
  
  <p>====</p>
  
  <p>I've got a Makefile that works fine on Ubuntu Linux to compile a JNI implementation for a Java Native project.  It makes use of my own static library "libpt.a". </p>
  
  <p>I'm trying to have the Makefile compile on Yosemite OSX.  It mostly does, but it's failing to link against just a handful of symbols in libpt.a (which I have specifically recompiled on OSX in this case).</p>
  
  <pre><code>g++  -L. -shared -o "libphoto_jni.dylib" PhotoNativeInterface.o -lpt
  Undefined symbols for architecture x86_64:
    "_parseWpiEnumString", referenced from:
        parseWpiAngle(char const*) in PhotoNativeInterface.o
        parseWpiCategory(char const*) in PhotoNativeInterface.o
        parseWpiColor(char const*) in PhotoNativeInterface.o
        parseWpiProcessingQuality(char const*) in PhotoNativeInterface.o
  </code></pre>
  
  <p>However, the symbol appears to be right there:</p>
  
  <pre><code>$ ls -al libpt.a
  -rw-r--r--  1 jdowdell  110244447  2493728 Dec 14 13:23 libpt.a
  $ nm libpt.a
  [redacted]
  libpt.a(lib.cc.o):
  [redacted]
  0000000000000000 T _parseWpiEnumString
  [redacted]
  $ ar -x libpt.a lib.cc.o
  $ file lib.cc.o
  lib.cc.o: Mach-O 64-bit object x86_64
  </code></pre>
  
  <p>If it matters:</p>
  
  <pre><code>$ g++ -v
  Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
  Target: x86_64-apple-darwin14.5.0
  Thread model: posix
  </code></pre>