cc65-floatlib
cc65-floatlib copied to clipboard
Errors building floattest.c
Hi! First I wanted to say, I am so grateful and delighted that you've undertaken this effort! Thank you! I just started with cc65 a few days ago and discovered there was no floating point then found your project. So I tried it out and I got the errors below. I commented out the lines with those functions and it builds and runs, although I haven't verified them. Is this an error in how I'm using this, or an error with the library? Is there anything I can do to help fix this? Thank you.
Noah@DESKTOP-VL0THH1 /cygdrive/c/Users/Noah/fun/c64/cc65-floatlib
$ make
ca65 float.s -o float.o
cc65 floatc.c -o floatc.s
ca65 floatc.s -o floatc.o
ar65 a runtime.lib float.o floatc.o
cl65 floattest.c runtime.lib -o floattest.prg
floattest.c(162): Warning: Constant is long
gcc -O2 -W -Wall -Wextra -o floattest -lm floattest.c
In file included from floattest.c:10:0:
floattest.c: In function ‘calcsin’:
floattest.c:61:37: warning: implicit declaration of function ‘fsin’; did you mean ‘fmin’? [-Wimplicit-function-declaration]
csetpoint8(XNUM2+(ftoi(fmul(fsin(deg2rad(itof(i),itof(YNUM))),itof(YNUM2)))/(YNUM/XNUM)));
^
float.h:149:28: note: in definition of macro ‘ftoi’
#define ftoi(a) ((int)(a))
^
floattest.c:61:32: note: in expansion of macro ‘fmul’
csetpoint8(XNUM2+(ftoi(fmul(fsin(deg2rad(itof(i),itof(YNUM))),itof(YNUM2)))/(YNUM/XNUM)));
^~~~
floattest.c:61:42: warning: implicit declaration of function ‘deg2rad’ [-Wimplicit-function-declaration]
csetpoint8(XNUM2+(ftoi(fmul(fsin(deg2rad(itof(i),itof(YNUM))),itof(YNUM2)))/(YNUM/XNUM)));
^
float.h:149:28: note: in definition of macro ‘ftoi’
#define ftoi(a) ((int)(a))
^
floattest.c:61:32: note: in expansion of macro ‘fmul’
csetpoint8(XNUM2+(ftoi(fmul(fsin(deg2rad(itof(i),itof(YNUM))),itof(YNUM2)))/(YNUM/XNUM)));
^~~~
floattest.c: In function ‘calccos’:
floattest.c:70:17: warning: implicit declaration of function ‘fcos’; did you mean ‘acos’? [-Wimplicit-function-declaration]
fd=fmul(fcos(fs),itof(YNUM2));
^
float.h:121:23: note: in definition of macro ‘fmul’
#define fmul(a,b) ((a)*(b))
^
/tmp/ccAMzp5l.o:floattest.c:(.text+0x106): undefined reference to `deg2rad'
/tmp/ccAMzp5l.o:floattest.c:(.text+0x10e): undefined reference to `fsin'
/tmp/ccAMzp5l.o:floattest.c:(.text+0x1a6): undefined reference to `deg2rad'
/tmp/ccAMzp5l.o:floattest.c:(.text+0x1bc): undefined reference to `fcos'
collect2: error: ld returned 1 exit status
make: *** [makefile:19: floattest] Error 1
thats strange, i dont even get a warning :) my guess would be that in cygwin the testprogram finds the systems "math.h" before the one from the lib. (its really not a good idea to use them this way, remember its just a test)
but hey, its just the test program, remove "floattest" from the all: target in the makefile and it should work for you