It looks extremely weird, but I was unable to compile following simple code:
inline void inline_func() {} static inline void static_inline_func() {} void some_func() { // THERE IS A PROBLEM with "inline" function inline_func(); // THERE IS NO PROBLEM with "static inline" function static_inline_func(); } int main(int argc, char *argv[]) { some_func(); return 0; } Compiler simply produces error:
$ gcc -Wall -o main main.c /usr/bin/ld: /tmp/ccs7lKMm.o: in function `some_func': main.c:(.text+0x15): undefined reference to `inline_func' collect2: error: ld returned 1 exit status I tried this code also with Clang compiler and got similar problem.
Edit
I don't think this question is a duplicate. It isn't a question about the difference between inline and static inline. This question is about the reason why an inline function cannot be compiled by some compilers while it is compiled by others (see comments).
Edit
This code can be compiled without errors using the -Os optimization argument:
$ gcc -Wall -Os -o main main.c
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1).void inline_func(void). Declaring asvoid inline_func();simply does not specify the type or number of arguments.