Reputation: 30138
Problem is simple... I manually write .h and .cpp files, so sometimes I'm worried that ill declare a function and because of typing error or something Ill either define a different function or Ill completely forgett about it. So is there a tool that would recursively go through all may source folders and detect if pairs (SOMETHING.cpp and SOMETHING.h) have mismatches... I know that sometimes it is desired(or at lest I remember hearing that being a trick of some sort) but I would like to avoid it.
Upvotes: 1
Views: 151
Reputation: 154037
When you attempt to use the function, you'll get an error from the linker. Since you're testing all of the functions you write (you are, I hope), you won't be able to link the tests if you've a typo in the function name in the sources.
Another thing that can help: put your functions in a namespace. In the header, you'll write
namespace MyNamespace {
void myFunction(...)
}
In the source, you don't open the namespace, but specify it for each function:
void MyNamespace::myFunction(...) { ... }
If myFunction
hasn't been previously declared in MyNamespace
, the compiler will complain.
Upvotes: 3