Xianwen Chen <xianwen.chen@xxxxxxxxx> writes: > 1) if I compile it as 'gcc -Wall -g -m64 -lm64 -o foo foo.c', it complains: > /usr/bin/ld: cannot find -lm64 > collect2: ld returned 1 exit status You should use "-lm" (not "-lm64"), regardless of -m64 or -m32 ... and: > 2) if I compile it as 'gcc -Wall -g -m64 -o foo foo.c', or 'gcc -Wall > -g -m32 -lm -o foo foo.c', it complains: > /dir/to/foo.c:15: undefined reference to `sqrt' > collect2: ld returned 1 exit status "-lm" should go _after_ anything that uses it. So: gcc -Wall -g -m64 -o foo foo.c -lm or: gcc -Wall -g -m32 -o foo foo.c -lm -Miles -- Year, n. A period of three hundred and sixty-five disappointments.