i have series of small library "modules" designed handle specific tasks. single module consists of .h
, .cpp
, , possibly set provide relevant non-friend, non-member functions user might find useful.
for example, foo.h
might declare class called foo
, foo.cpp
defines, , fooutilities.h
might declare function uses foo
defined fooutilities.cpp
.
normally use these modules in programs, add .h
, .cpp
project , #include
.h
in whatever files need it. however, larger programs use more potentially-interdependent modules, growing big inconvenience. therefore, i'd compile single monolithic static or dynamic library can add library file project, set header search directories folders contain aforementioned .h
files, , compile.
seems pretty simple, right? i'd have start new project static/dynamic library build target , add appropriate files. .cpp
files, #include
.h
files anyway, compiled , added final product.
however, of modules use templates , therefore have use .tpp
instead of .cpp
. .tpp
files meant organization , #include
d respective header files, opposite of how normal modules handled. because of this, just adding them library project won't compile anything.
how can work around this? should have compilethis.cpp
file includes modules use templates? if so, should file include non-template modules? seems rapidly become organizational mess.
many compilers cannot "precompile" templates libraries. best suggestion treat them header files; header files not compiled libraries, included.
i compile code library when amount of changes minimal. speeds build process since files don't need compiled again (and again...).
Comments
Post a Comment