Guest User

Untitled

a guest
Jul 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. undefined reference to `setgolf(golf&, char*, int)'
  2. collect2: error: ld returned 1 exit status
  3.  
  4. #ifndef SANS_H_INCLUDED
  5. #define SANS_H_INCLUDED
  6. const int len = 40;
  7. struct golf
  8. {
  9. char fullname[len];
  10. int handicap;
  11. };
  12.  
  13. //void setgolf(golf &,char * ,int);
  14. int setgolf(golf &);
  15. void sethandicap(golf &,int );
  16. void showgolf(const golf &);
  17. #endif
  18.  
  19. #include <iostream>
  20. #include <cstring>
  21. #include "chapter9exe3.h"
  22. void setgolf(golf & s,char *c ,int hc)
  23. {
  24. strcpy(s.fullname,c);
  25. s.handicap=hc;
  26. }
  27.  
  28. int setgolf(golf & s)
  29. {
  30. std::cin.getline(s.fullname,len);
  31. if(s.fullname[0] == ''&& s.fullname[1] == '' && s.fullname[2] == '')
  32. return 0;
  33. else
  34. return 1;
  35. }
  36.  
  37. void sethandicap(golf & s,int n )
  38. {
  39. s.handicap = n;
  40. }
  41.  
  42. void showgolf(const golf & s)
  43. {
  44. std::cout<<"the full name :"<<s.fullname<<std::endl;
  45. std::cout<<"the handcape :"<<s.handicap<<std::endl;
  46. }
  47.  
  48. #include <iostream>
  49. #include "sans.h"
  50. int main()
  51. {
  52. golf player;
  53. char name[len] = "santers God's men";
  54. int handicap = 84;
  55. setgolf(player,name,handicap);
  56. return 0;
  57. }
  58.  
  59. //void setgolf(golf &,char * ,int);
  60.  
  61. setgolf(player,name,handicap);
Add Comment
Please, Sign In to add comment