Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22137

Linker error inline function

$
0
0

I got some compiler/linker errors and i don't know what is the correct method to proceed. I'm in this situation:

  • a.h: in this file is defined a function declared as "inline", for example: inline void foo1();
  • b.h: in this file is defined a function declared as "inline" that calls foo1(): inline void foo2();
  • main.c: there are some functions calls of both foo1 and foo2().

Now, if i declare foo1 and foo2 in a.h and b.h as extern inline void i got the following error:

prj/src/b.o: In function foo1': (.text+0x0): multiple definition offoo1' prj/src/main.o:(.text+0x0): first defined here make: * [kernel] Error 1

What is the way which allow to compile and link without errors/warning in the situation i described?


Viewing all articles
Browse latest Browse all 22137

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>