No, this isn't correct. It will cause problems any time "fx.h" is used in more than one source file, since add is not inline. It violates the "One Definition Rule."
Is fx.cpp the "main.cpp"; or - is it in addition to the main.cpp? I've often been confused about whether to have multiple .cpps in a project.
It would be in addition to other source files in the project.
In that example how do I integrate fx.h, fx.cpp into main.cpp?
Assuming you're using an IDE, just add fx.cpp to your project. If you're using the command line, you would also compile fx.cpp and link the resulting object file.
It seems you dont have to include .cpp files though? Right.
If you're talking about the #include system, no - you should not #include them.
Also, which of the two solutions which you recommend? Ive been working with both.
I tend to favor the separate cpp solution, both because it hides unnecessary details and reduces overall compile time, although for a very simple function like this I'd probably go with the inline solution.