I have a library. It has a lot of header files. When I compile it in .lib , I need to connect in the project that uses this .lib , the main header file. This file connects hundreds of other header files from the source library folders. And it turns out that I need to carry with me all the header files, and hence the entire library in its original form.

I want to: shove all the header files into one and carry it with you, and not carry with you all the source code of the library.

How can I do it? And is it done like standard Visual Studio tools?

  • one
    Here they usually try not to advise the bad :) - PinkTux
  • @PinkTux is that badly bad? : D - JaminPeru
  • The bad thing is that you can break the dependencies and get potential problems when updating the library. But if your library is really, it makes sense to divide it initially into two entities: one is needed for the user of the finished library, the second for building it (such as lib.h and lib-dev.h ). - PinkTux

1 answer 1

It makes sense to make such a header file lib.h so that it contains only what is needed to use the finished library and there is nothing superfluous.

For example, your library uses within itself the entity A , for which there is a file Ah . If the fact of this dependency should not be available to the library user (i.e., no types from A are directly used by the user of your library), then the #include "Ah" should not be present in lib.h Consequently, the Ah file itself is not needed when distributing your library.

  • So I want to do so to use the finished library, but I do not know how. Perhaps there are tools in Visual Studio itself? For all these hundreds of files to transfer to one manually ... it's better to leave everything as it is. - JaminPeru
  • @JaminPeru and on the basis of what information this hypothetical tool can find out what to leave in lib.h , and what to move inside? - αλεχολυτ
  • I want to put all the headers of the library into one file :). - JaminPeru
  • @JaminPeru can not stop you in this desire. - αλεχολυτ
  • : D okay, I realized that this is not the best idea. - JaminPeru