Why do you have to link the math library in C?

The functions in stdlib.h and stdio.h have implementations in libc.so (or libc.a for static linking), which is linked into your executable by default (as if -lc were specified). GCC can be instructed to avoid this automatic link with the -nostdlib or -nodefaultlibs options. The math functions in math.h have implementations in libm.so (or libm.a for … Read more

C++ console app with two colliding objects not Working [closed]

This wild beast of human imagination delete ship1, ship2; deletes ship2, but doesn’t delete ship1. Comma here is treated as sequence (comma) operator, and result of such expression is result of last sub-expression. Your function always returns 1. You probably meant something like this int shipdetcol(spaceship &ship1, spaceship &ship2, float colrange) { return colrange > … Read more