Record Detail

Compile Error

/in/rational.c:4:17: error: 'struct RationalInt' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void set(struct RationalInt* a, int num, int den){
                 ^~~~~~~~~~~
/in/rational.c:4:6: error: conflicting types for 'set'
 void set(struct RationalInt* a, int num, int den){
      ^~~
In file included from /in/rational.c:1:0:
/in/main/rational.h:12:6: note: previous declaration of 'set' was here
 void set(RationalInt *a, int num, int den);
      ^~~
/in/rational.c: In function 'set':
/in/rational.c:5:7: error: dereferencing pointer to incomplete type 'struct RationalInt'
     a -> numerator = num;
       ^~
/in/rational.c: At top level:
/in/rational.c:9:17: error: 'struct RationalInt' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void set(struct RationalInt* a , struct RationalInt b) {
                 ^~~~~~~~~~~
/in/rational.c:9:53: error: parameter 2 ('b') has incomplete type
 void set(struct RationalInt* a , struct RationalInt b) {
                                                     ^
/in/rational.c:9:6: error: conflicting types for 'set'
 void set(struct RationalInt* a , struct RationalInt b) {
      ^~~
In file included from /in/rational.c:1:0:
/in/main/rational.h:12:6: note: previous declaration of 'set' was here
 void set(RationalInt *a, int num, int den);
      ^~~
/in/rational.c: In function 'set':
/in/rational.c:10:7: error: dereferencing pointer to incomplete type 'struct RationalInt'
     a -> numerator = a -> numerator * b.denominator +a -> denominator * b.numerator;
       ^~
/in/rational.c:9:53: error: unused parameter 'b' [-Werror=unused-parameter]
 void set(struct RationalInt* a , struct RationalInt b) {
                                                     ^
/in/rational.c: At top level:
/in/rational.c:14:22: error: 'struct RationalInt' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void subtract(struct RationalInt* a, struct RationalInt b){
                      ^~~~~~~~~~~
/in/rational.c:14:57: error: parameter 2 ('b') has incomplete type
 void subtract(struct RationalInt* a, struct RationalInt b){
                                                         ^
/in/rational.c: In function 'subtract':
/in/rational.c:15:7: error: dereferencing pointer to incomplete type 'struct RationalInt'
     a -> numerator = a -> numerator * b.denominator - a -> denominator * b.numerator;
       ^~
/in/rational.c:14:57: error: unused parameter 'b' [-Werror=unused-parameter]
 void subtract(struct RationalInt* a, struct RationalInt b){
                                                         ^
/in/rational.c: At top level:
/in/rational.c:19:22: error: 'struct RationalInt' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void multiply(struct RationalInt* a , struct RationalInt b) {
                      ^~~~~~~~~~~
/in/rational.c:19:58: error: parameter 2 ('b') has incomplete type
 void multiply(struct RationalInt* a , struct RationalInt b) {
                                                          ^
/in/rational.c: In function 'multiply':
/in/rational.c:20:7: error: dereferencing pointer to incomplete type 'struct RationalInt'
     a -> numerator = a -> numerator * b.denominator;
       ^~
/in/rational.c:22:5: error: ISO C forbids nested functions [-Werror=pedantic]
     int gcd (int a, int b){
     ^~~
/in/rational.c:19:58: error: unused parameter 'b' [-Werror=unused-parameter]
 void multiply(struct RationalInt* a , struct RationalInt b) {
                                                          ^
/in/rational.c: At top level:
/in/rational.c:31:20: error: 'struct RationalInt' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void divide(struct RationalInt* a , struct RationalInt b){
                    ^~~~~~~~~~~
/in/rational.c:31:56: error: parameter 2 ('b') has incomplete type
 void divide(struct RationalInt* a , struct RationalInt b){
                                                        ^
/in/rational.c: In function 'divide':
/in/rational.c:32:7: error: dereferencing pointer to incomplete type 'struct RationalInt'
     a -> numerator = a -> numerator * b.denominator;
       ^~
/in/rational.c:34:5: error: ISO C forbids nested functions [-Werror=pedantic]
     int gcd(int a, int b){
     ^~~
/in/rational.c:39:60: error: 'denominator' undeclared (first use in this function)
     a -> numerator = a -> numerator / gcd(a -> numerator , denominator);
                                                            ^~~~~~~~~~~
/in/rational.c:39:60: note: each undeclared identifier is reported only once for each function it appears in
/in/rational.c:31:56: error: unused parameter 'b' [-Werror=unused-parameter]
 void divide(struct RationalInt* a , struct RationalInt b){
                                                        ^
/in/rational.c: At top level:
/in/rational.c:43:19: error: 'struct RationalInt' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void print(struct RationalInt* a){
                   ^~~~~~~~~~~
/in/rational.c:43:6: error: conflicting types for 'print'
 void print(struct RationalInt* a){
      ^~~~~
In file included from /in/rational.c:1:0:
/in/main/rational.h:17:6: note: previous declaration of 'print' was here
 void print(RationalInt *a);
      ^~~~~
/in/rational.c: In function 'print':
/in/rational.c:44:24: error: dereferencing pointer to incomplete type 'struct RationalInt'
     printf("%d/%d\n", a->numerator, a->denominator);
                        ^~
cc1: all warnings being treated as errors

Information

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