This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

undefined inline functions while using arm gnu gcc toolchain 10.2.1

I was using arm gnu gcc toolchain 6.3.1 earlier and the following piece of code compiles without any errors.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
__inline unsigned int add(unsigned int i, unsigned int j)
{
// some random sample code for example
int ans = 0;
for (int a = 0; a < j; a++) {
ans = ans + 2;
}
for (int a = 0; a < i; a++) {
ans = ans + 2;
}
for (int a = 0; a < j; a++) {
ans = ans - 1;
}
for (int a = 0; a < i; a++) {
ans = ans - 1;
}
return ans;
}
unsigned int add1(unsigned int i, unsigned int j)
{
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

When when I updated the toolchain to 10.2.1 I was getting the inline function as undefined

Fullscreen
1
2
3
4
5
6
7
8
arm-none-eabi-ld: libapps.a(hello_main.o): in function `add1':
hello/hello_main.c:84: undefined reference to `add'
arm-none-eabi-ld: libapps.a(hello_main.o): in function `add2':
hello/hello_main.c:89: undefined reference to `add'
arm-none-eabi-ld: libapps.a(hello_main.o): in function `add3':
hello/hello_main.c:94: undefined reference to `add'
arm-none-eabi-ld: libapps.a(hello_main.o): in function `add4':
hello/hello_main.c:99: undefined reference to `add'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

As far as I understand, the compilers are backward compatible so I shouldn't be getting any errors for using a new toolchain version. Is there any way to fix the undefined inline functions error if possible without making any modifications to the existing code.

0