2

I have composed below small program to explain the issue,

#include<stdio.h>

inline void test() {
        printf("test inline\n");
        return;
}
int main () {
        test();
        return 0;
}

While compiling it gives below error.

jeegarp@jeegarp:~$ gcc test.c 
/tmp/ccrpsWXN.o: In function `main':
4.c:(.text+0xa): undefined reference to `test'
collect2: error: ld returned 1 exit status

Now if i mark my inline function as static then i do not see this error.

I am not able to understand this observation.

Does it compiler specific issue?

Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222

0 Answers0