c++ - How to ship a shared library with one header file? -


i want create shared library, based on several source files, each header file. now, header1.hpp includes line #include "header2.hpp", in turn includes line #include "header3.hpp", in turn includes line #include "header4.hpp", , on...

but ship library single header file. functions library needs expose in header1.hpp. seems have ship these other header files along it, not seem right. typically when given library, comes 1 header...

you can use c preprocessor assemble includes single one:

1) create dummy.c file includes required header files (just toplevel ones). there may single 1 if have 1 directly or not includes other ones.

2) cc -e dummy.c > single_header.h

3) need filter-out comes system includes in generated header file. comes different headers indicated lines start '#' sign. can quite write perl or awk or peek-your-favourite-small-language program strips-out not want, typically between statement like

# xxx "/usr/include/something.h" yyy zzzz 

and next line starts #


Comments