I was always confused about header files. They are so strange: you include .h file which doesn't include .cpp but .cpp are somehow compiled too.
Recently I joined a team project, and of course, both .h and .cpp are used.
I understand that this is very important, but I can't live with copy-pasting every function declaration in each of multiple classes we have.
How do I handle the 2-file convention efficiently?
Are there any tools to help with that, or automatically change one file that looks like example below to .h and .cpp? (specifically for MS VC++ 2010)
class A
{
...
Type f(Type a,Type b)
{
//implementation here, not in another file!
}
...
};
Type f(Type a)
{
//implementation here
}
...
Best Answer
You could use Lzz. It's a command line tool that takes declarations written in a C++ syntax and generates the header and source files.