title: How to make a C++ code public headers internal?
body: <p>I want to build a <code>dll</code> from my C++ code. The problem is that the code has more than 200 <code>.h</code> header files <strong>that nearly all of them are public</strong>; i.e., when I build the <code>dll</code> and I want to use it in another program, in addition to <code>#include</code>ing the headers of the needed functions, I have to give all of the header files that were used for building the <code>dll</code> to the compiler.</p>
  
  <p>I only need a few functions from the <code>dll</code>, but since nearly each header has <code>#include</code>d some other headers (i.e., all headers are public)  I have to give all of the header files to the compiler when using the <code>dll</code> library. </p>
  
  <p>What is easiest way to come with just a few public headers to use with the<code>dll</code>? I tried to replace each <code>#include "xxxx.h</code> with it's source code in some headers to make them stand-alone (public) and then built the library, but didn't work (many errors/ too cumbersome). I don't want to rewrite all of the headers. (a solution was suggested in <a href="https://stackoverflow.com/questions/23652815/when-using-a-dll-library-is-it-necessary-to-include-all-of-the-headers-used-to#comment36331580_23652865">this comment</a> by @Angew)</p>
  
  <p>For example, can I somehow  write a cpp file containing my needed function and a header for it, and then use the previously built <code>dll</code> (with all of the headers) and then build a new <code>dll</code> with just one public header from it?</p>