title: C wrapper around C++ library without unnecessary header files
body: <p>C++ newbie here. I'm creating a C wrapper around C++ library which expose just <code>foo()</code> function.</p>
  
  <p><em>wrapper.h</em></p>
  
  <pre><code>#include "SomeLibrary.h"
  #include "SomeAnotherLibrary.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
    void foo();
  #ifdef __cplusplus
  }
  #endif
  </code></pre>
  
  <p><em>wrapper.cpp</em></p>
  
  <pre><code>#include "wrapper.h"
  
  void foo() {
    // calls to `SomeLibrary.h` and `SomeAnotherLibrary.h` functions...
  }
  </code></pre>
  
  <p>I would like to compile this code just to be able to call <code>foo()</code> from a different C code. Note that I care just about the <code>foo()</code> function. I would like to completely ignore <code>SomeLibrary.h</code> and <code>SomeAnotherLibrary.h</code> header files.</p>
  
  <p>So I tried to compilethe wrapper into object file <code>wrapper.o</code> as follows:</p>
  
  <pre><code>g++ -c wrapper.cpp -o wrapper.o -I../some_library/include -I../some_other_library/include -L../some_library/lib -lSomeFirstLibrary -lSomeSecondLibrary
  </code></pre>
  
  <p><strong>Problem</strong>:</p>
  
  <p>When I used <code>wrapper.o</code> in my C project, it still require me to load bunch of header files from <code>SomeLibrary.h</code> and <code>SomeAnotherLibrary.h</code> (which I do not care about at all). Here is my C project code:</p>
  
  <p><em>my_project.c</em>:</p>
  
  <pre><code>#include "wrapper.h"
  
  void main() {
    foo();
  }
  </code></pre>
  
  <p>And compile it:</p>
  
  <pre><code>gcc my_project.c wrapper.o -o my_project
  </code></pre>
  
  <p>Which yields following error:</p>
  
  <pre><code>my_program.c:3:28: fatal error: SomeLibrary.h: No such file or directory
  </code></pre>
  
  <p><strong>Question</strong>:</p>
  
  <p>How I should compile the wrapper to ignore all other header files except <code>wrapper.h</code>?</p>