Advertisement
Guest User

Overloading == error

a guest
Apr 10th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.80 KB | None | 0 0
  1. g++ -c -o obj/main.o main.cpp -I../include
  2. main.cpp:8:62: error: ‘bool coord::operator==(const coord&, const coord&)’ must take exactly one argument
  3. inline bool operator==(const coord& lhs, const coord& rhs){
  4. ^
  5. main.cpp: In function ‘int main()’:
  6. main.cpp:24:6: error: no match for ‘operator==’ (operand types are ‘coord’ and ‘coord’)
  7. if(a==b){
  8. ^
  9. main.cpp:24:6: note: candidates are:
  10. In file included from /usr/include/c++/4.9.2/iosfwd:40:0,
  11. from /usr/include/c++/4.9.2/ios:38,
  12. from /usr/include/c++/4.9.2/ostream:38,
  13. from /usr/include/c++/4.9.2/iostream:39,
  14. from main.cpp:1:
  15. /usr/include/c++/4.9.2/bits/postypes.h:216:5: note: template<class _StateT> bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&)
  16. operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
  17. ^
  18. /usr/include/c++/4.9.2/bits/postypes.h:216:5: note: template argument deduction/substitution failed:
  19. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::fpos<_StateT>’
  20. if(a==b){
  21. ^
  22. In file included from /usr/include/c++/4.9.2/bits/stl_algobase.h:64:0,
  23. from /usr/include/c++/4.9.2/bits/char_traits.h:39,
  24. from /usr/include/c++/4.9.2/ios:40,
  25. from /usr/include/c++/4.9.2/ostream:38,
  26. from /usr/include/c++/4.9.2/iostream:39,
  27. from main.cpp:1:
  28. /usr/include/c++/4.9.2/bits/stl_pair.h:214:5: note: template<class _T1, class _T2> bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
  29. operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
  30. ^
  31. /usr/include/c++/4.9.2/bits/stl_pair.h:214:5: note: template argument deduction/substitution failed:
  32. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::pair<_T1, _T2>’
  33. if(a==b){
  34. ^
  35. In file included from /usr/include/c++/4.9.2/bits/stl_algobase.h:67:0,
  36. from /usr/include/c++/4.9.2/bits/char_traits.h:39,
  37. from /usr/include/c++/4.9.2/ios:40,
  38. from /usr/include/c++/4.9.2/ostream:38,
  39. from /usr/include/c++/4.9.2/iostream:39,
  40. from main.cpp:1:
  41. /usr/include/c++/4.9.2/bits/stl_iterator.h:292:5: note: template<class _Iterator> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
  42. operator==(const reverse_iterator<_Iterator>& __x,
  43. ^
  44. /usr/include/c++/4.9.2/bits/stl_iterator.h:292:5: note: template argument deduction/substitution failed:
  45. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::reverse_iterator<_Iterator>’
  46. if(a==b){
  47. ^
  48. In file included from /usr/include/c++/4.9.2/bits/stl_algobase.h:67:0,
  49. from /usr/include/c++/4.9.2/bits/char_traits.h:39,
  50. from /usr/include/c++/4.9.2/ios:40,
  51. from /usr/include/c++/4.9.2/ostream:38,
  52. from /usr/include/c++/4.9.2/iostream:39,
  53. from main.cpp:1:
  54. /usr/include/c++/4.9.2/bits/stl_iterator.h:342:5: note: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
  55. operator==(const reverse_iterator<_IteratorL>& __x,
  56. ^
  57. /usr/include/c++/4.9.2/bits/stl_iterator.h:342:5: note: template argument deduction/substitution failed:
  58. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::reverse_iterator<_Iterator>’
  59. if(a==b){
  60. ^
  61. In file included from /usr/include/c++/4.9.2/string:41:0,
  62. from /usr/include/c++/4.9.2/bits/locale_classes.h:40,
  63. from /usr/include/c++/4.9.2/bits/ios_base.h:41,
  64. from /usr/include/c++/4.9.2/ios:42,
  65. from /usr/include/c++/4.9.2/ostream:38,
  66. from /usr/include/c++/4.9.2/iostream:39,
  67. from main.cpp:1:
  68. /usr/include/c++/4.9.2/bits/allocator.h:128:5: note: template<class _T1, class _T2> bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_T2>&)
  69. operator==(const allocator<_T1>&, const allocator<_T2>&)
  70. ^
  71. /usr/include/c++/4.9.2/bits/allocator.h:128:5: note: template argument deduction/substitution failed:
  72. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::allocator<_CharT>’
  73. if(a==b){
  74. ^
  75. In file included from /usr/include/c++/4.9.2/string:41:0,
  76. from /usr/include/c++/4.9.2/bits/locale_classes.h:40,
  77. from /usr/include/c++/4.9.2/bits/ios_base.h:41,
  78. from /usr/include/c++/4.9.2/ios:42,
  79. from /usr/include/c++/4.9.2/ostream:38,
  80. from /usr/include/c++/4.9.2/iostream:39,
  81. from main.cpp:1:
  82. /usr/include/c++/4.9.2/bits/allocator.h:133:5: note: template<class _Tp> bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_CharT>&)
  83. operator==(const allocator<_Tp>&, const allocator<_Tp>&)
  84. ^
  85. /usr/include/c++/4.9.2/bits/allocator.h:133:5: note: template argument deduction/substitution failed:
  86. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::allocator<_CharT>’
  87. if(a==b){
  88. ^
  89. In file included from /usr/include/c++/4.9.2/string:52:0,
  90. from /usr/include/c++/4.9.2/bits/locale_classes.h:40,
  91. from /usr/include/c++/4.9.2/bits/ios_base.h:41,
  92. from /usr/include/c++/4.9.2/ios:42,
  93. from /usr/include/c++/4.9.2/ostream:38,
  94. from /usr/include/c++/4.9.2/iostream:39,
  95. from main.cpp:1:
  96. /usr/include/c++/4.9.2/bits/basic_string.h:2505:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)
  97. operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
  98. ^
  99. /usr/include/c++/4.9.2/bits/basic_string.h:2505:5: note: template argument deduction/substitution failed:
  100. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::basic_string<_CharT, _Traits, _Alloc>’
  101. if(a==b){
  102. ^
  103. In file included from /usr/include/c++/4.9.2/string:52:0,
  104. from /usr/include/c++/4.9.2/bits/locale_classes.h:40,
  105. from /usr/include/c++/4.9.2/bits/ios_base.h:41,
  106. from /usr/include/c++/4.9.2/ios:42,
  107. from /usr/include/c++/4.9.2/ostream:38,
  108. from /usr/include/c++/4.9.2/iostream:39,
  109. from main.cpp:1:
  110. /usr/include/c++/4.9.2/bits/basic_string.h:2512:5: note: template<class _CharT> typename __gnu_cxx::__enable_if<std::__is_char<_Tp>::__value, bool>::__type std::operator==(const std::basic_string<_CharT>&, const std::basic_string<_CharT>&)
  111. operator==(const basic_string<_CharT>& __lhs,
  112. ^
  113. /usr/include/c++/4.9.2/bits/basic_string.h:2512:5: note: template argument deduction/substitution failed:
  114. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::basic_string<_CharT>’
  115. if(a==b){
  116. ^
  117. In file included from /usr/include/c++/4.9.2/string:52:0,
  118. from /usr/include/c++/4.9.2/bits/locale_classes.h:40,
  119. from /usr/include/c++/4.9.2/bits/ios_base.h:41,
  120. from /usr/include/c++/4.9.2/ios:42,
  121. from /usr/include/c++/4.9.2/ostream:38,
  122. from /usr/include/c++/4.9.2/iostream:39,
  123. from main.cpp:1:
  124. /usr/include/c++/4.9.2/bits/basic_string.h:2526:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
  125. operator==(const _CharT* __lhs,
  126. ^
  127. /usr/include/c++/4.9.2/bits/basic_string.h:2526:5: note: template argument deduction/substitution failed:
  128. main.cpp:24:8: note: mismatched types ‘const _CharT*’ and ‘coord’
  129. if(a==b){
  130. ^
  131. In file included from /usr/include/c++/4.9.2/string:52:0,
  132. from /usr/include/c++/4.9.2/bits/locale_classes.h:40,
  133. from /usr/include/c++/4.9.2/bits/ios_base.h:41,
  134. from /usr/include/c++/4.9.2/ios:42,
  135. from /usr/include/c++/4.9.2/ostream:38,
  136. from /usr/include/c++/4.9.2/iostream:39,
  137. from main.cpp:1:
  138. /usr/include/c++/4.9.2/bits/basic_string.h:2538:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
  139. operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
  140. ^
  141. /usr/include/c++/4.9.2/bits/basic_string.h:2538:5: note: template argument deduction/substitution failed:
  142. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::basic_string<_CharT, _Traits, _Alloc>’
  143. if(a==b){
  144. ^
  145. In file included from /usr/include/c++/4.9.2/bits/locale_facets.h:48:0,
  146. from /usr/include/c++/4.9.2/bits/basic_ios.h:37,
  147. from /usr/include/c++/4.9.2/ios:44,
  148. from /usr/include/c++/4.9.2/ostream:38,
  149. from /usr/include/c++/4.9.2/iostream:39,
  150. from main.cpp:1:
  151. /usr/include/c++/4.9.2/bits/streambuf_iterator.h:204:5: note: template<class _CharT, class _Traits> bool std::operator==(const std::istreambuf_iterator<_CharT, _Traits>&, const std::istreambuf_iterator<_CharT, _Traits>&)
  152. operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
  153. ^
  154. /usr/include/c++/4.9.2/bits/streambuf_iterator.h:204:5: note: template argument deduction/substitution failed:
  155. main.cpp:24:8: note: ‘coord’ is not derived from ‘const std::istreambuf_iterator<_CharT, _Traits>’
  156. if(a==b){
  157. ^
  158. Makefile:17: recipe for target 'obj/main.o' failed
  159. make: *** [obj/main.o] Error 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement