inline or not, once the header is copied in at least two files, you can no longer link the files.
The only way to safely use the function in the header is to use static . Thus, each copy of the function will be invisible to others.
Please note that there are no restrictions on their use, so you can safely write:
static inline bool testab(int a, int b) { return a>b; }
Edit: Details
inline tells the compiler that you think the function is small enough to be inline. That is, you tell the compiler that you do not think that the additional space for imposing the function matters, but not the (insignificant) (possible) performance enhancement for it. Most compilers, however, are smart enough to decide that on their own and with your keyword, they will just be a little more oriented to the built-in ones and itβs not necessary to always listen to you. Of course, it depends on the compiler. Some compilers may completely ignore the keyword.
static , on the other hand, means that no matter what area is defined by a static variable, it will be invisible outside of it. If the function has a static variable, it will be invisible outside of it. If you have a static variable in the file (that is, a static global variable), it will be invisible outside of it, which means that after compilation for the linker, the symbol does not exist and is confused. That is why if you wrote a library that has global variables or functions that should not be visible outside the library, you must declare them static .
Edit 2: Correction
Apparently, according to this , inline functions should not have their identifiers exported for the linker. However, you can attach static to it anyway to make it more understandable. Apparently, some compilers still export the identifier, so static is really required in such cases.