UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor mdvankar1990
Visitor
1,243 Views
Registered: ‎08-09-2017

error while using math.h library in zynq 7000 zc 702 board application programme.

Jump to solution

hi guys,

I m trying to simple program.

#include <stdio.h>

#include <math.h>

#include "platform.h"

int main()

{

float a,b,c,d;

a=2.3;

b=2.5;

c=a+b;

d=cosf(c);

}

in this  i am getting "undefined reference to cosf ".

in this function,

instead of using variable c, if i use some value it gets run.

like cosf(2.5);

but using variable gives above error.

solution??

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Voyager
Voyager
1,796 Views
Registered: ‎04-13-2015

Re: error while using math.h library in zynq 7000 zc 702 board application programme.

Jump to solution

You need to link with the math library,

In the linker setting, add "m" (without the quotes) in the library window.

 

The reason it works when you put a constant is the compiler replaces cosf(2.5) by the resulting value.

 

Regards

 

1 Reply
Voyager
Voyager
1,797 Views
Registered: ‎04-13-2015

Re: error while using math.h library in zynq 7000 zc 702 board application programme.

Jump to solution

You need to link with the math library,

In the linker setting, add "m" (without the quotes) in the library window.

 

The reason it works when you put a constant is the compiler replaces cosf(2.5) by the resulting value.

 

Regards