I am trying to write a quick program in C that uses sin/cos. But all the variables I use are ints (whereas sin/cos need floats). So KermM gave me some code to try for that: (int)sin((float)myinteger)
But, I think something is up because I get this error(s):
$ make
nspire-gcc -Os -Wall -W -fpic -fno-merge-constants -D NON_CAS -c main.c
main.c: In function 'main':
main.c:64:3: warning: implicit declaration of function 'cos'
main.c:64:13: warning: incompatible implicit declaration of built-in function 'cos'
main.c:65:3: warning: implicit declaration of function 'sin'
main.c:65:13: warning: incompatible implicit declaration of built-in function 'sin'
nspire-ld main.o utils.o graphics3.o -o Trapped.elf
main.o: In function `main':
main.c:(.text+0xd8): undefined reference to `cos'
main.c:(.text+0x278): undefined reference to `cos'
main.c:(.text+0x2a4): undefined reference to `sin'
main.c:(.text+0x330): undefined reference to `cos'
main.c:(.text+0x358): undefined reference to `sin'
collect2: ld returned 1 exit status
make: *** [Trapped.tns] Error 1
On this line: y += (int)sin((float)direction) * y_speed;
Any help please :)
But, I think something is up because I get this error(s):
$ make
nspire-gcc -Os -Wall -W -fpic -fno-merge-constants -D NON_CAS -c main.c
main.c: In function 'main':
main.c:64:3: warning: implicit declaration of function 'cos'
main.c:64:13: warning: incompatible implicit declaration of built-in function 'cos'
main.c:65:3: warning: implicit declaration of function 'sin'
main.c:65:13: warning: incompatible implicit declaration of built-in function 'sin'
nspire-ld main.o utils.o graphics3.o -o Trapped.elf
main.o: In function `main':
main.c:(.text+0xd8): undefined reference to `cos'
main.c:(.text+0x278): undefined reference to `cos'
main.c:(.text+0x2a4): undefined reference to `sin'
main.c:(.text+0x330): undefined reference to `cos'
main.c:(.text+0x358): undefined reference to `sin'
collect2: ld returned 1 exit status
make: *** [Trapped.tns] Error 1
On this line: y += (int)sin((float)direction) * y_speed;
Any help please :)