From Using the GNU compiler:
When a function is both inline and static, if all calls to the function are integrated into the caller, and the function's address is never used, then the function's own assembler code is never referenced. In this case, GCC does not actually output assembler code for the function, unless you specify the option -fkeep-inline-functions. Some calls cannot be integrated for various reasons (in particular, calls that precede the function's definition cannot be integrated, and neither can recursive calls within the definition). If there is a nonintegrated call, then the function is compiled to assembler code as usual. The function must also be compiled as usual if the program refers to its address, because that can't be inlined.
Thus if yout don't include stdlib.h, there is no code the linker could use to link against the symbol test()
, because in fact there is no such function.
But although your program will compile and run if test()
is not inline
you should always include the appropriate header files, as this allows the compiler to check for return value and paraemeter types.