J
James Douglas
I've copy-pasted the following from my terminal. I thought "inline"
functions were allowed to have multiple identical definitions, but GCC is
complaining.
$ cat f.h
inline void Func(void)
{
}
$ cat a.c
#include "f.h"
int main(void)
{
Func();
return 0;
}
$ cat b.c
#include "f.h"
void Hello(void)
{
Func();
}
$ gcc -std=c99 a.c b.c
/tmp/ccYf20Ik.o: In function `main':
a.c.text+0x12): undefined reference to `Func'
/tmp/ccsnIe6q.o: In function `Hello':
b.c.text+0x7): undefined reference to `Func'
collect2: ld returned 1 exit status
For now I'm using the following hack:
$ gcc -D inline=static -std=c99 a.c b.c
functions were allowed to have multiple identical definitions, but GCC is
complaining.
$ cat f.h
inline void Func(void)
{
}
$ cat a.c
#include "f.h"
int main(void)
{
Func();
return 0;
}
$ cat b.c
#include "f.h"
void Hello(void)
{
Func();
}
$ gcc -std=c99 a.c b.c
/tmp/ccYf20Ik.o: In function `main':
a.c.text+0x12): undefined reference to `Func'
/tmp/ccsnIe6q.o: In function `Hello':
b.c.text+0x7): undefined reference to `Func'
collect2: ld returned 1 exit status
For now I'm using the following hack:
$ gcc -D inline=static -std=c99 a.c b.c