According to
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf,
it looks like inline functions behave differently in C and C++:
Any function with internal linkage can be an inline function. For a
function with external linkage, the following restrictions apply: If a
function is declared with an inline function specifier, then it shall
also be defined in the same translation unit. If all of the file scope
declarations for a function in a translation unit include the inline
function specifier without extern, then the definition in that
translation unit is an inline definition. An inline definition does
not provide an external definition for the function, and does not
forbid an external definition in another translation unit. An inline
definition provides an alternative to an external definition, which a
translator may use to implement any call to the function in the same
translation unit. It is unspecified whether a call to the function
uses the inline definition or the external definition. 140)
If you don't put static
there, you're defining an inline function with external linkage without instantiating an external definition.
extern int add(int, int);
instatiates the external definition for that function, and you need to do that exactly once (doesn't matter in which file) for the linking to succeed (or you can mark the inline function static
and the problem vanishes).
(In C++ the inline
creates weak external definitions in each translation unit so you don't have to worry about marking things static
or instantiating exactly one external definition for the inline function--g++ should straightforwardly compile it with for f in *.c; do g++ -c "$f"; done; g++ *.o
without any problems.)