I am facing a problem when using the inline keyword.
In header file:
void checkContinuation() __attribute__((always_inline));
In the source file:
void __attribute__((always_inline)) checkContinuation() { ..... }
In the main file I called it, but I got a compilation error in which said
undefined reference to checkContinuation()
I read all these link inline with external linkage & inline function linkage
And what I've understood that the inline function in C++ has external linkage which means that only one definition for the function must be available but others said that It must be definied in each translation unit in which it is used.
So what is the correct answer and how can I use define it once but user it a lot?
Also, What is the correct syntax for the inline function attribute in both header and source file? and what is the difference between it and __always_inline
?