servetgulnaroglu / cube.c

https://youtu.be/p09i_hoFdd0
408 stars 125 forks source link

Error while running #3

Closed TwistedVision518 closed 9 months ago

TwistedVision518 commented 1 year ago

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 tosin' /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:25: undefined reference to cos' /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:26: undefined reference tocos' /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 sin' /usr/bin/ld: /home//spinningcube.c:26: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:26: undefined reference to cos' /usr/bin/ld: /tmp/ccaqCFiq.o: in functioncalculateY': /home//spinningcube.c:30: undefined reference to cos' /usr/bin/ld: /home//spinningcube.c:30: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:30: undefined reference to sin' /usr/bin/ld: /home//spinningcube.c:30: undefined reference tocos' /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 sin' /usr/bin/ld: /home//spinningcube.c:31: undefined reference tocos' /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:32: undefined reference to cos' /usr/bin/ld: /home//spinningcube.c:32: undefined reference tosin' /usr/bin/ld: /tmp/ccaqCFiq.o: in function calculateZ': /home//spinningcube.c:36: undefined reference tocos' /usr/bin/ld: /home//spinningcube.c:36: undefined reference to cos' /usr/bin/ld: /home//spinningcube.c:36: undefined reference tosin' /usr/bin/ld: /home//spinningcube.c:36: undefined reference to cos' /usr/bin/ld: /home//spinningcube.c:36: undefined reference tosin' collect2: error: ld returned 1 exit status

Build finished with error(s).

scorpius2k1 commented 1 year 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!

TwistedVision518 commented 1 year ago

thanks it does