Assume that two pieces of code use the same tempolate header. If the two pieces are compiled separately and linked together. Then there might be a duplicated definition error. How to avoid this problem?
To be clearer, e.g. I have these three files:
a.hh:
b.cc:Code:int func(int i){ ... }
.Code:#include "a.hh" ...
c.cc:
Compile and link:Code:#include "a.hh" ...
Code:g++ -c b.cc g++ -c c.cc g++ b.o c.o