Andes Workshop
http://forum.andestech.com/

undefined reference to `__adddf3'
http://forum.andestech.com/viewtopic.php?f=25&t=808
Page 1 of 1

Author:  cindy [ Thu Feb 27, 2014 11:51 pm ]
Post subject:  undefined reference to `__adddf3'

Code:

#include <stdio.h>
#include <stdlib.h>

int main(void) {

   double a = 123456.0;
   double b = 65432.0;

   double c ;
   int d = 5;

   c= a+b;
   c= a-b;
   c= a*b;
   c= a/b;

   printf("%lf",c);

   return EXIT_SUCCESS;
}


Some errors occur:
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:22: undefined reference to `__adddf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:22: undefined reference to `__adddf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:23: undefined reference to `__subdf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:23: undefined reference to `__subdf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:24: undefined reference to `__muldf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:24: undefined reference to `__muldf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:25: undefined reference to `__divdf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:25: undefined reference to `__divdf3'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:27: undefined reference to `printf'
C:\Andestech\AndeSight201MCU\mcu_64\workspace\float_test\Debug/../src/float_test.c:27: undefined reference to `printf'

This is because we set "-nostdlib" to avoiding default library. Delete this option can solve the problem.
Attachment:
solution.png
solution.png [ 80.42 KiB | Viewed 7654 times ]


Sample code: (This have link errors)
Attachment:
float_test.zip [13.42 KiB]
Downloaded 806 times



Reference:
http://stackoverflow.com/questions/2187 ... pplication

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/