undefined reference to `__udivsi3 | developer.brewmp.com undefined reference to `__udivsi3 | developer.brewmp.com

Developer

undefined reference to `__udivsi3

Hi all,

i get this error during linking my cpp app...

c:/gnude/arm-elf/lib/libc.a(fwrite.o)(.text+0x60): In function `fwrite':: undefined reference to `__udivsi3'

i am not sure what i need to do to get my code compiled any ideas will help.
linker options that i am using are

c:/gnude/bin/arm-elf-ld.exe -Ttext 0 --emit-relocs -entry AEEMod_Load -o myapp.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1 -Lc:/gnude/arm-elf/lib AEEModGen.o AEEAppGen.o GCCResolver.o myapp.o -lgcc -lstdc++ -lc

-Premal

premal wrote:Hi all,
i get this error during linking my cpp app...
c:/gnude/arm-elf/lib/libc.a(fwrite.o)(.text+0x60): In function `fwrite':: undefined reference to `__udivsi3'
i am not sure what i need to do to get my code compiled any ideas will help.
linker options that i am using are
c:/gnude/bin/arm-elf-ld.exe -Ttext 0 --emit-relocs -entry AEEMod_Load -o myapp.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1 -Lc:/gnude/arm-elf/lib AEEModGen.o AEEAppGen.o GCCResolver.o myapp.o -lgcc -lstdc++ -lc
-Premal
Add -lm to the end of your linker line to link with the maths libs.
Though why the function 'fwrite' is getting dragged in is another matter.
Steve.

premal wrote:Hi all,
i get this error during linking my cpp app...
c:/gnude/arm-elf/lib/libc.a(fwrite.o)(.text+0x60): In function `fwrite':: undefined reference to `__udivsi3'
i am not sure what i need to do to get my code compiled any ideas will help.
linker options that i am using are
c:/gnude/bin/arm-elf-ld.exe -Ttext 0 --emit-relocs -entry AEEMod_Load -o myapp.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1 -Lc:/gnude/arm-elf/lib AEEModGen.o AEEAppGen.o GCCResolver.o myapp.o -lgcc -lstdc++ -lc
-Premal
Add -lm to the end of your linker line to link with the maths libs.
Though why the function 'fwrite' is getting dragged in is another matter.
Steve.

hey thanks..
That worked... i was wondering the same thing why is it going to fwrite.. has anyone worked with one of the stripped down versions of library ? the one i was checking out is available at uclibc.org
thanks,
-Premal

hey thanks..
That worked... i was wondering the same thing why is it going to fwrite.. has anyone worked with one of the stripped down versions of library ? the one i was checking out is available at uclibc.org
thanks,
-Premal

the function is included in the libgcc.a
whenever you use the divide operator,for example: i=a/3; , this obj file is needed.

the function is included in the libgcc.a
whenever you use the divide operator,for example: i=a/3; , this obj file is needed.

Hi all,
I've got the same problem with the modulus operator %, mentioned in this thread. I have tried linking to the maths lib with -lm, but this does not fix the problem for me. Strange, as it seemed to work for others...
All my code compiles fine. I have 3 static libraries. Static lib A builds fine. Static lib B which depends on static lib A and uses % builds fine. However when I build static lib C which does not use % but depends on static libs B and A, I get the linker errors for static lib B where % has been used.
Can anyone shed any light on this? I am using GNUARM 4.1 and programming in C++.
Thanks in advance!

Hi all,
I've got the same problem with the modulus operator %, mentioned in this thread. I have tried linking to the maths lib with -lm, but this does not fix the problem for me. Strange, as it seemed to work for others...
All my code compiles fine. I have 3 static libraries. Static lib A builds fine. Static lib B which depends on static lib A and uses % builds fine. However when I build static lib C which does not use % but depends on static libs B and A, I get the linker errors for static lib B where % has been used.
Can anyone shed any light on this? I am using GNUARM 4.1 and programming in C++.
Thanks in advance!

I made certain that -lgcc was the last thing in the dependency list, and it all compiled and linked fine!

I made certain that -lgcc was the last thing in the dependency list, and it all compiled and linked fine!