Record Detail

Compile Error

/in/rational.c: In function 'reduce':
/in/rational.c:33:15: error: called object 'gcd' is not a function or function pointer
     int gcd = gcd(a->num, a->den);
               ^~~
/in/rational.c:33:9: note: declared here
     int gcd = gcd(a->num, a->den);
         ^~~
/in/rational.c: In function 'set':
/in/rational.c:40:12: error: incompatible type for argument 1 of 'reduce'
     reduce(*a,a->num,a->den);
            ^
/in/rational.c:29:6: note: expected 'RationalInt * {aka struct rational_t *}' but argument is of type 'RationalInt {aka struct rational_t}'
 void reduce(RationalInt *a)
      ^~~~~~
/in/rational.c:40:5: error: too many arguments to function 'reduce'
     reduce(*a,a->num,a->den);
     ^~~~~~
/in/rational.c:29:6: note: declared here
 void reduce(RationalInt *a)
      ^~~~~~
/in/rational.c:41:12: error: 'return' with a value, in function returning void [-Werror]
     return a;
            ^
/in/rational.c:37:6: note: declared here
 void set(RationalInt *a, int num, int den)
      ^~~
/in/rational.c:37:30: error: unused parameter 'num' [-Werror=unused-parameter]
 void set(RationalInt *a, int num, int den)
                              ^~~
/in/rational.c:37:39: error: unused parameter 'den' [-Werror=unused-parameter]
 void set(RationalInt *a, int num, int den)
                                       ^~~
/in/rational.c: In function 'add':
/in/rational.c:47:20: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
         a->num *= b->den;
                    ^~
/in/rational.c:48:10: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
         b->num *= a->den;
          ^~
/in/rational.c:49:16: error: variable 'result' has initializer but incomplete type
         struct fraction result = {
                ^~~~~~~~
/in/rational.c:50:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->num + b->num,
                           ^~
/in/rational.c:50:17: error: excess elements in struct initializer [-Werror]
                 a->num + b->num,
                 ^
/in/rational.c:50:17: note: (near initialization for 'result')
/in/rational.c:51:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->den * b->den
                           ^~
/in/rational.c:51:17: error: excess elements in struct initializer [-Werror]
                 a->den * b->den
                 ^
/in/rational.c:51:17: note: (near initialization for 'result')
/in/rational.c:49:25: error: storage size of 'result' isn't known
         struct fraction result = {
                         ^~~~~~
/in/rational.c:54:16: error: 'return' with a value, in function returning void [-Werror]
         return result;
                ^~~~~~
/in/rational.c:43:6: note: declared here
 void add(RationalInt *a, const RationalInt b)
      ^~~
/in/rational.c:49:25: error: unused variable 'result' [-Werror=unused-variable]
         struct fraction result = {
                         ^~~~~~
/in/rational.c: In function 'subtract':
/in/rational.c:61:20: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
         a->num *= b->den;
                    ^~
/in/rational.c:62:10: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
         b->num *= a->den;
          ^~
/in/rational.c:63:16: error: variable 'result' has initializer but incomplete type
         struct fraction result = {
                ^~~~~~~~
/in/rational.c:64:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->num - b->num,
                           ^~
/in/rational.c:64:17: error: excess elements in struct initializer [-Werror]
                 a->num - b->num,
                 ^
/in/rational.c:64:17: note: (near initialization for 'result')
/in/rational.c:65:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->den * b->den
                           ^~
/in/rational.c:65:17: error: excess elements in struct initializer [-Werror]
                 a->den * b->den
                 ^
/in/rational.c:65:17: note: (near initialization for 'result')
/in/rational.c:63:25: error: storage size of 'result' isn't known
         struct fraction result = {
                         ^~~~~~
/in/rational.c:68:16: error: 'return' with a value, in function returning void [-Werror]
         return result;
                ^~~~~~
/in/rational.c:57:6: note: declared here
 void subtract(RationalInt *a, const RationalInt b)
      ^~~~~~~~
/in/rational.c:63:25: error: unused variable 'result' [-Werror=unused-variable]
         struct fraction result = {
                         ^~~~~~
/in/rational.c: In function 'multiply':
/in/rational.c:75:16: error: variable 'result' has initializer but incomplete type
         struct fraction result = {
                ^~~~~~~~
/in/rational.c:76:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->num * b->num,
                           ^~
/in/rational.c:76:17: error: excess elements in struct initializer [-Werror]
                 a->num * b->num,
                 ^
/in/rational.c:76:17: note: (near initialization for 'result')
/in/rational.c:77:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->den * b->den
                           ^~
/in/rational.c:77:17: error: excess elements in struct initializer [-Werror]
                 a->den * b->den
                 ^
/in/rational.c:77:17: note: (near initialization for 'result')
/in/rational.c:75:25: error: storage size of 'result' isn't known
         struct fraction result = {
                         ^~~~~~
/in/rational.c:80:16: error: 'return' with a value, in function returning void [-Werror]
         return result;
                ^~~~~~
/in/rational.c:71:6: note: declared here
 void multiply(RationalInt *a, const RationalInt b)
      ^~~~~~~~
/in/rational.c:75:25: error: unused variable 'result' [-Werror=unused-variable]
         struct fraction result = {
                         ^~~~~~
/in/rational.c: In function 'divide':
/in/rational.c:86:16: error: variable 'result' has initializer but incomplete type
         struct fraction result = {
                ^~~~~~~~
/in/rational.c:87:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->num * b->den,
                           ^~
/in/rational.c:87:17: error: excess elements in struct initializer [-Werror]
                 a->num * b->den,
                 ^
/in/rational.c:87:17: note: (near initialization for 'result')
/in/rational.c:88:27: error: invalid type argument of '->' (have 'RationalInt {aka const struct rational_t}')
                 a->den * b->num
                           ^~
/in/rational.c:88:17: error: excess elements in struct initializer [-Werror]
                 a->den * b->num
                 ^
/in/rational.c:88:17: note: (near initialization for 'result')
/in/rational.c:86:25: error: storage size of 'result' isn't known
         struct fraction result = {
                         ^~~~~~
/in/rational.c:91:16: error: 'return' with a value, in function returning void [-Werror]
         return result
                ^~~~~~
/in/rational.c:83:6: note: declared here
 void divide(RationalInt *a, const RationalInt b)
      ^~~~~~
/in/rational.c:92:5: error: expected ';' before '}' token
     }
     ^
/in/rational.c:86:25: error: unused variable 'result' [-Werror=unused-variable]
         struct fraction result = {
                         ^~~~~~
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Lab 10
Language
C
Submit At
2020-07-20 00:12:59
Judged At
2020-07-20 00:12:59
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes