I'm using multiple C++ files in one project for the first time. Both have need to include a protected (#ifndef) header file. However, when I do that, I get a multiple definition error.
From what I found from research, adding the word inline before the function fixes the error. Is this the right way to do this, and why does it work? Should I make a habbit of just declaring any function that might be used in two .cpp files as inline?
Unless the function is actually small enough that you would want to inline it, you should just define it in a single source file (usually named the same as the relevant header) and include only the prototype in the header.
every header must define a "prevent" marcro that forbids any include action if the macro is still defined for that module (so, preventing multiple declarations). Every macro in every header should be unique.... usually I call my macro with the filename.... with the syntax shown in the example I posted