sin() Function unbekannt

#3939781
Lesenswert?

Hallo zusammen

Ich habe folgenden Code-teil:
1
#include <math.h>
2
....
3

4

5
uint16_t i=0;
6

7
for(i= 0; i < SCALE; i++)
8
{
9
   sine[i] = (int)(sin(PI2 * i / SCALE) * SCALE);
10
   cosi[i] = (int)(cos(PI2 * i / SCALE) * SCALE);
11
}

Compiler sagt:

---> undefined reference to `sin'
---> undefined reference to `cos'


Wenn ich jedoch dies schreibe:
1
uint16_t i=0;
2

3
sin(12);
4

5
for(i= 0; i < SCALE; i++)
6
{
7
   sine[i] = (int)(sin(PI2 * i / SCALE) * SCALE);
8
   cosi[i] = (int)(cos(PI2 * i / SCALE) * SCALE);
9
}

So hat er keine Probleme mit dem
1
sin(12);

Mach dies Sinn?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren