In this answer https://stackoverflow.com/a/4193698/738811 it's written that "Inline functions by default have external linkage". However it's not possible by default to link against something what is inline. So what's the sense to say that inline functions have external linkage?
4 Answers
The linkage of a name has nothing to do with where or how it is defined, just with where the name may be used to refer to a particular object or function.
Declaring a function inline does not force it to be inlined; it just relaxes the One Definition Rule to allow a definition in each translation unit in which it's used (and require one in each translation unit in which it's called), to make it easier to inline. It doesn't prevent a non-inline version being generated, if the compiler decides not to inline a particular call to it, or if you take the address of it.
So "external linkage" and "inline" are not exclusive; "external linkage" means that the function may be referred to in any translation unit, and "inline" means that it must be defined in any translation unit that calls it.

- 249,747
- 28
- 448
- 644
Maybe a better way to express it is "If linkage is necessary, it will be external". Meaning, if you take the address of the inline function, that address will be externally visible (not a static to a module).

- 2,880
- 13
- 19
Inline functions aren't necessarily expanded inline. When they aren't, the language definition requires that there be only one copy of the function.

- 74,985
- 8
- 76
- 165
Inline functions are typically "linkable" from other compile units. They won't appear as inline functions. There is a copy of the function in the compiled file. This applies to free inline functions. Class member functions do not, typically get a copy of the function for "non-inline" use. Good linkers will also remove the code as "dead code" if it's never rerferenced.

- 126,704
- 14
- 140
- 227