Why does this:
cause this:Code:#include <stdio.h> #include <math.h> int main () { float i; for (i=0.0f;i<3.1415f;i+=0.1f) printf("%f sin=%f cos=%f\n",i,sin(i),cos(i)); }
undefined reference to `cos'
undefined reference to `sin'
Why does this:
cause this:Code:#include <stdio.h> #include <math.h> int main () { float i; for (i=0.0f;i<3.1415f;i+=0.1f) printf("%f sin=%f cos=%f\n",i,sin(i),cos(i)); }
undefined reference to `cos'
undefined reference to `sin'
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
You may need to link the math library, e.g., -lm with gcc.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)