ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

My code doesn't properly compiles on server Compiler.
Posted by moonwalker 25 Aug 2012 12:25
I'm using gcc version 4.6.2 on SUSE linux
Code compiles on my computer without error, but at server
there are a lot of errors during compilation. This is compiling process errors:
________________________________________________________________________________________
27e5fc42-d41b-42da-9ed8-452e7ff6161d
27e5fc42-d41b-42da-9ed8-452e7ff6161d(29) : error C2143: syntax error : missing ';' before 'type'
27e5fc42-d41b-42da-9ed8-452e7ff6161d(31) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(31) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(31) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(31) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(33) : error C2143: syntax error : missing ';' before 'type'
27e5fc42-d41b-42da-9ed8-452e7ff6161d(35) : error C2065: 'rope_lenght' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(35) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
27e5fc42-d41b-42da-9ed8-452e7ff6161d(37) : error C2065: 'a' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(37) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(37) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(37) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(37) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(38) : error C2065: 'b' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(38) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(38) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(38) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(38) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : error C2065: 'rope_lenght' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : error C2065: 'a' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : error C2065: 'a' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : error C2065: 'b' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : error C2065: 'b' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : warning C4244: 'function' : conversion from 'int' to 'float', possible loss of data
27e5fc42-d41b-42da-9ed8-452e7ff6161d(40) : warning C4244: '+=' : conversion from 'float' to 'int', possible loss of data
27e5fc42-d41b-42da-9ed8-452e7ff6161d(42) : error C2065: 'a' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(42) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(42) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(42) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(42) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(43) : error C2065: 'b' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(43) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(43) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(43) : error C2065: 'nail' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(43) : error C2109: subscript requires array or pointer type
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : error C2065: 'rope_lenght' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : error C2065: 'a' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : error C2065: 'a' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : error C2065: 'b' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : error C2065: 'b' : undeclared identifier
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : warning C4244: 'function' : conversion from 'int' to 'float', possible loss of data
27e5fc42-d41b-42da-9ed8-452e7ff6161d(45) : warning C4244: '+=' : conversion from 'float' to 'int', possible loss of data
27e5fc42-d41b-42da-9ed8-452e7ff6161d(47) : error C2065: 'rope_lenght' : undeclared identifier
_______________________________________________________________________________________

and this is my program code:
_______________________________________________________________________________________
#include <stdio.h>
#include <stdlib.h>

#define PI 3.1415926535

struct fcoord {
    float x, y;
};

float sqr(float n)
{
    float a = 1, b = n;

    int i = 1000;
    while (i--) {
        a = (a+b)/2;
        b = n/a;
    }

    return a;
}

int main()
{
    int nail_num, i;
    float nail_radius;
    fscanf(stdin, "%d %f", &nail_num, &nail_radius);

    struct fcoord * nail = (struct fcoord *) malloc(sizeof (struct fcoord) * nail_num);
    for (i = 0; i < nail_num; i++)
        fscanf(stdin, "%f %f", &(nail[ i ].x), &(nail[ i ].y));

    float rope_lenght = 0, a, b;

    rope_lenght += (2 * PI * nail_radius);
    for (i = 0; (i+1) < nail_num; i++) {
        a = nail[ i ].x-nail[ i+1 ].x;
        b = nail[ i ].y-nail[ i+1 ].y;

        rope_lenght += sqr((a*a) + (b*b));
    }
    a = nail[ nail_num-1 ].x - nail[ 0 ].x;
    b = nail[ nail_num-1 ].y - nail[ 0 ].y;

    rope_lenght += sqr((a*a) + (b*b));

    fprintf(stdout, "%.2f\n", rope_lenght);


    return 0;
}
_______________________________________________________________________________________

Please help!

Edited by author 25.08.2012 12:30