Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:compile error problem 1005

Posted by frkstyc at 2008-05-19 21:03:30
In Reply To:compile error problem 1005 Posted by:yatt at 2008-05-19 21:00:42
M_PI is not defined

> I wrote a code below and compiled it by gcc4.1.2 with -lm option and checked getting right answer in sample case.
> But when I submit it with selecting GCC, then got a compile error.
> I cannot understand what error message means(what is `Main.c'?) 
> so I tried sometime and got same result, compile error. 
> what's happen? did I take a mistake?
> 
> #include<stdio.h>
> #include<math.h>
> 
> #define DEBUG(x)
> 
> double hdivpi = 100.0/M_PI;
> 
> int f(double x, double y)
> {
>   double d = sqrt(x*x + y*y);
>   double dn = sqrt(hdivpi);
>   double tmp;
>   double acc =dn;
>   int year;
> 
>   DEBUG( printf("distance = %lf\n", d); )
> 
>   for (year = 1; acc < d; year++){
>     DEBUG( printf("acc = %lf;  dn = %lf;  \n", acc, dn); )
>     tmp = sqrt(hdivpi +dn*dn);
>     acc += tmp- dn;
>     dn = tmp;
>   }
>   return year;
> }
> 
> int main()
> {
>   int i, n;
>   double x, y;
>   
>   scanf("%d", &n);
>   for (i = 1; i <= n; i++){
>     scanf("%lf%lf", &x, &y);
>     printf("Property %d: This property will begin eroding in year %d.\n",
> 	   i, f(x, y));
>   }
>   printf("END OF OUTPUT.\n");
>   return 0;
> }
> 
> 
> 
> here is error message.
> 
> Main.c:6: error: `M_PI' undeclared here (not in a function)
> Main.c: In function `f':
> Main.c:10: error: syntax error before '/' token
> Main.c:13: error: `dn' undeclared (first use in this function)
> Main.c:13: error: (Each undeclared identifier is reported only once
> Main.c:13: error: for each function it appears in.)
> Main.c:20: error: `tmp' undeclared (first use in this function)

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator