I can't compile this program!
Ajay Bansal
Ajay_Bansal@infosys.com
Fri Feb 14 05:30:00 GMT 2003
Link the program with math library
gcc -o test test.c -lm
I feel that every systemshould follow the man page standards of solaris
(if it is not proprietery). In their man page they mention the library
to be linked with.. Like
Mathematical Library sqrt(3M)
NAME
sqrt - square root function
SYNOPSIS
cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
double sqrt(double x);
DESCRIPTION
The sqrt() function computes the square root of x.
-----Original Message-----
From: japan [mailto:ngmnhat@yahoo.com]
Sent: Friday, February 14, 2003 10:56 AM
To: gcc-help@gcc.gnu.org
Subject: I can't compile this program!
I want to ask some questions!
I have an ANSI C program named test.c:
/*test.c*/
#include <stdio.h>
#include <math.h>
main()
{
printf("%f\n",sqrt(4));
return 0;
}
I can't compile this code. I used command:
gcc -o test test.c
Please tell me why and how to compile that code!
Thanks.
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
More information about the Gcc-help
mailing list