foo.cc: In function 'int main()':
foo.cc:11:20: error: 'y' was not declared in this scope
  for(int k=y1;k<y2;y++)
                    ^
foo.cc:13:19: error: 'd' was not declared in this scope
  sum=sum+Gd(y2,m2,d);
                   ^
foo.cc:13:19: note: suggested alternative: 'd2'
  sum=sum+Gd(y2,m2,d);
                   ^
                   d2
foo.cc:15:11: error: 'y' was not declared in this scope
  cout<<Gd(y)<<m1(d)<<endl;
           ^
foo.cc:15:11: note: suggested alternative: 'y2'
  cout<<Gd(y)<<m1(d)<<endl;
           ^
           y2
foo.cc:15:19: error: 'm1' cannot be used as a function
  cout<<Gd(y)<<m1(d)<<endl;
                   ^
foo.cc:9:12: warning: unused variable 'd2' [-Wunused-variable]
  int y2,m2,d2;
            ^~