Closed TwistedVision518 closed 9 months ago
On some systems, the math functions are in a separate library, which needs to be linked explicitly. Simply pass the option -lm when compiling (linking) your program, and everything should work.
Try (may need to replace gcc with your specific gcc-9):
gcc -lm spinningcube.c
Hope this helps!
thanks it does
Error is
Starting build... /usr/bin/gcc-9 -fdiagnostics-color=always -g /home/pranav/spinningcube.c -o /home//spinningcube /usr/bin/ld: /tmp/ccaqCFiq.o: in function
calculateX': /home//spinningcube.c:25: undefined reference to
sin' /usr/bin/ld: /home//spinningcube.c:25: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:25: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:25: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:25: undefined reference to
sin' /usr/bin/ld: /home//spinningcube.c:25: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:26: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:26: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:26: undefined reference to
sin' /usr/bin/ld: /home//spinningcube.c:26: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:26: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:26: undefined reference tocos' /usr/bin/ld: /tmp/ccaqCFiq.o: in function
calculateY': /home//spinningcube.c:30: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:30: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:30: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:30: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:31: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:31: undefined reference to
sin' /usr/bin/ld: /home//spinningcube.c:31: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:31: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:31: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:31: undefined reference to
sin' /usr/bin/ld: /home//spinningcube.c:32: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:32: undefined reference to
sin' /usr/bin/ld: /tmp/ccaqCFiq.o: in functioncalculateZ': /home//spinningcube.c:36: undefined reference to
cos' /usr/bin/ld: /home//spinningcube.c:36: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:36: undefined reference to
sin' /usr/bin/ld: /home//spinningcube.c:36: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:36: undefined reference to
sin' collect2: error: ld returned 1 exit statusBuild finished with error(s).