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 reference to '__floatsisf'

hello,

I'm using uVision3 on a lpc2129 target. While trying to compile and link this:

int a;
float b:
a++;
b = a;

I get this error when linking: "error: undefined reference to '__floatsisf'"

Any idea of why this is happening?

thanks in advance,

MAURO

  • does the version you have support floating-point (other eval versions don't)

  • Quoting the Restrictions in Keil website:

    "The GNU ARM tools (compiler, assembler, and so on) that are provided are not limited or restricted in any way."

    that means that i should be able to use floating point variables, right?

    So can the problem be that I should include any header file that I'm not including?

  • "The GNU ARM tools (compiler, assembler, and so on) that are provided are not limited or restricted in any way."

    That should probably actually say that Keil have not imposed any special restrictions of their own - so you need to refer to the GNU documentation to find out about its floating-point support.

    "So can the problem be that I should include any header file that I'm not including?"

    You said it's a Linker error; header files have nothing whatsoever to do with the Linker, so they will make no difference to any Linker errors.
    You probably need to add a Library.
    As noted above, you will probably have to consult the GNU documentation to find out precisely what library/ies is/are required...

    BTW: Even though you are using an ARM (and not a poor little 8051), floating point is still generally best avoided in embedded applications.
    Have you considered fixed-point arithmentic?

  • You need to check under Project - Options - Linker - Use Math Libraries. Is this the case in your project?

  • "You need to check under Project - Options - Linker - Use Math Libraries. Is this the case in your project?"

    Actually the solution is pretty close to what Keil Support suggests. Under Project - Options - Linker I had checked "Do not use Standar System Libraries". Unchecking this option solved the problem.

    And as a corollary. If you uncheck "Use Math libraries", and you want to use a math function (pow(), exp(), etc... ) it wont work, no matter if you #include <math.h>. So in order to use math functions "Use Math libraries" has to be checked.

    Thanks for the help!

  • "Under Project - Options - Linker I had checked 'Do not use Standar System Libraries'"

    Having thus explicitly told the Linker not to use the standard libraries, it should come as no surprise to find that the standard library support for floating point is not there!
    Hence the error!

    "And as a corollary. If you uncheck 'Use Math libraries', and you want to use a math function (pow(), exp(), etc... ) it wont work..."

    Of course it won't - if the libraries aren't there, anything that tries to use them will obviously not work!

    "... no matter if you #include <math.h>."

    As I said earlier, "header files have nothing whatsoever to do with the Linker"

    A header file simply tells the Compiler to expect that the functions will be provided elsewhere.