title: What's the difference between clang and clang++ when building a library?
body: <p>I was compiling a c library (to be used by a c++ project) with clang. I got linker errors (specifically, undefined symbol regarding the hqxInit function) when trying to link this library. When I switch to clang++, it works. Checking with nm, clang++ munges the names further. What is going on—and is there a better way to tell the linker that a library is munged-for-c versus munged-for-c++? It seems silly to have to build a c library with c++....</p>
  
  <p>// built with clang</p>
  
  <pre><code>$ nm libhqx.a
  
  libhqx.bak(init.c.o)
  04000000 C _RGBtoYUV
  00000004 C _YUV1
  00000004 C _YUV2
  00000000 T _hqxInit
  </code></pre>
  
  <p>// built with clang++</p>
  
  <pre><code>$ nm libhqx.a 
  
  libhqx.a(init.o):
  00000100 S _RGBtoYUV
  04000100 S _YUV1
  04000104 S _YUV2
  00000000 T __Z7hqxInitv
  </code></pre>