SuperH Linux Math library - Embedded

This is a discussion on SuperH Linux Math library - Embedded ; Hi all, I'm trying to compile a small program (IIR oscillator) and want to use atan, cos and sin functions including the math.h library. The compiler doesn't complain about not finding the math.h file, indeed he finds it. But: he@so:~/codec$ ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SuperH Linux Math library

  1. SuperH Linux Math library

    Hi all,

    I'm trying to compile a small program (IIR oscillator) and want to use
    atan, cos and sin functions including the math.h library. The compiler
    doesn't complain about not finding the math.h file, indeed he finds it.

    But:

    he@so:~/codec$ sh3-linux-gcc -I /usr/sh3-linux/include codec.c
    /tmp/ccUqutnQ.o: In function `main':
    /tmp/ccUqutnQ.o(.text+0x180): undefined reference to `atan'
    /tmp/ccUqutnQ.o(.text+0x19c): undefined reference to `cos'
    /tmp/ccUqutnQ.o(.text+0x1a0): undefined reference to `sin'
    collect2: ld returned 1 exit status

    What's wrong?

    Thank you.

    Ivan.


  2. Re: SuperH Linux Math library

    Ivan Wagner wrote:
    > Hi all,
    >
    > I'm trying to compile a small program (IIR oscillator) and want to use
    > atan, cos and sin functions including the math.h library. The compiler
    > doesn't complain about not finding the math.h file, indeed he finds it.
    >
    > But:
    >
    > he@so:~/codec$ sh3-linux-gcc -I /usr/sh3-linux/include codec.c
    > /tmp/ccUqutnQ.o: In function `main':
    > /tmp/ccUqutnQ.o(.text+0x180): undefined reference to `atan'
    > /tmp/ccUqutnQ.o(.text+0x19c): undefined reference to `cos'
    > /tmp/ccUqutnQ.o(.text+0x1a0): undefined reference to `sin'
    > collect2: ld returned 1 exit status
    >
    > What's wrong?
    >
    > Thank you.
    >
    > Ivan.
    >


    you need -lm in your build command line to tell the linker to use the
    math library.

  3. Re: SuperH Linux Math library

    Oh yeah you're right... It's long time since I did this last time...



    Thank you,

    Ivan.



    Tim Keck wrote:
    > Ivan Wagner wrote:
    > > Hi all,
    > >
    > > I'm trying to compile a small program (IIR oscillator) and want to use
    > > atan, cos and sin functions including the math.h library. The compiler
    > > doesn't complain about not finding the math.h file, indeed he finds it.
    > >
    > > But:
    > >
    > > he@so:~/codec$ sh3-linux-gcc -I /usr/sh3-linux/include codec.c
    > > /tmp/ccUqutnQ.o: In function `main':
    > > /tmp/ccUqutnQ.o(.text+0x180): undefined reference to `atan'
    > > /tmp/ccUqutnQ.o(.text+0x19c): undefined reference to `cos'
    > > /tmp/ccUqutnQ.o(.text+0x1a0): undefined reference to `sin'
    > > collect2: ld returned 1 exit status
    > >
    > > What's wrong?
    > >
    > > Thank you.
    > >
    > > Ivan.
    > >

    >
    > you need -lm in your build command line to tell the linker to use the
    > math library.



+ Reply to Thread