title: How do I call a C++ function from C?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4014851/how-to-call-a-lib-written-in-c-from-c">How to call a lib written in C++ from C?</a>  </p>
  </blockquote>
  
  
  
  <p>I am tinkering with <a href="http://www.phash.org/docs/howto.html" rel="nofollow noreferrer">pHash</a> and I want to call the function for generating a perceptual hash from file location. When I try to call the function called ph_dct_imagehash the compiler throws this error:</p>
  
  <pre><code>/usr/include/CImg.h:72:18: fatal error: cstdio: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>At this point I realize that pHash is written in C++, so including C++ headers in a C program isn't going to work. Nonetheless the function itself seems like it should be callable from C as none of it's parameters nor it's return value use C++ constructs. Is there any good way to call the C++ function ph_dct_imagehash from C?</p>
  
  <p>Note: I am mostly doing this to get better at C (not C++). This is why I am restricting myself to C.</p>