[C言語]関数電卓

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define PI 3.14159265

int main(void){
	char c[128],fnc[128];
	double x=0,y,z=0;
	double rd=PI/180.0;

	printf("関数電卓\n");
	printf("sin X, cos X, tan X\n");
	printf("exp X, log X, ln X\n");
	printf("sqr X, X ^ Y\n");

	printf("数値 X:");
	gets(c); x=atof(c);
	printf("関数:");
	gets(fnc);
	if(strcmp(fnc,"^")==0){   // strcmpは文字列の比較
		printf("数値 Y:");
		gets(c); y=atof(c);
	}  
	if(strcmp(fnc,"sin")==0)
		{z=sin(x*rd);}
	else if(strcmp(fnc,"cos")==0)
		{z=cos(x*rd);}
	else if(strcmp(fnc,"tan")==0)
		{z=tan(x*rd);}
	else if(strcmp(fnc,"exp")==0)  // exp(x)とは自然対数の底eのx乗, 微分しても値が変わらない
		{z=exp(x);}
	else if(strcmp(fnc,"log")==0) // 底が10である対数
		{z=log10(x);}
	else if(strcmp(fnc,"ln")==0)  // 底がeである対数
		{z=log(x);}
	else if(strcmp(fnc,"sqr")==0)  // x の y 乗の値
		{z=sqrt(x);}
	else if(strcmp(fnc,"pow")==0)
		{z=pow(x,y);}
	else
		{printf("関数がありません。\n");}
	
	printf("答え:%4.8f\n\n",z);

	return 0;
}

v$ gcc -o main main.c
main.c: In function ‘main’:
main.c:19:2: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
gets(c); x=atof(c);
^~~~
fgets
/tmp/ccbBDDqy.o: In function `main’:
main.c:(.text+0x93): warning: the `gets’ function is dangerous and should not be used.
main.c:(.text+0x15c): undefined reference to `sin’
main.c:(.text+0x19c): undefined reference to `cos’
main.c:(.text+0x1dc): undefined reference to `tan’
main.c:(.text+0x222): undefined reference to `exp’
main.c:(.text+0x268): undefined reference to `log10′
main.c:(.text+0x2ae): undefined reference to `log’
main.c:(.text+0x2f4): undefined reference to `sqrt’
main.c:(.text+0x343): undefined reference to `pow’
collect2: error: ld returned 1 exit status
あれ??