Doing cc -std=c99 example.c
on the following simplified example.c
file:
inline void a()
{
}
int main()
{
a();
return 0;
}
gets me:
In function `main':
example.c:(.text+0x7): undefined reference to 'a'
collect2: ld returned 1 exit status
As I understand this has to do with the requirement of C99 standard to demand exactly one more definition for each inline non-static function that is used in cases where the body cannot be inlined? If that is so, I am guessing I could do with static inline
instead, but I don't want this to bite me later, so what would be the best course of action here? Obviously, I want to stick to C99 and I want to inline some functions. (Yes, I am aware the compiler usually knows what to inline without being told so, but I have my reasons)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…