Record Detail

Compile Error

/in/Rectangle.cpp: In member function 'int Rectangle::getArea(MyPoint, MyPoint, MyPoint, MyPoint)':
/in/Rectangle.cpp:5:6: error: unused variable 'area' [-Werror=unused-variable]
  int area = (topRightPoint.x - topLeftPoint.x) * (topLeftPoint.y - bottomLeftPoint.y);
      ^~~~
/in/Rectangle.cpp:6:1: error: no return statement in function returning non-void [-Werror=return-type]
 }
 ^
/in/Rectangle.cpp:3:32: error: unused parameter 'bottomRightPoint' [-Werror=unused-parameter]
 int Rectangle::getArea(MyPoint bottomRightPoint, MyPoint bottomLeftPoint, MyPoint topLeftPoint, MyPoint topRightPoint)
                                ^~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
/in/MyPoint.cpp: In member function 'MyPoint MyPoint::constructor()':
/in/MyPoint.cpp:10:1: error: no return statement in function returning non-void [-Werror=return-type]
 }
 ^
/in/MyPoint.cpp: In member function 'MyPoint MyPoint::constructor(int, int)':
/in/MyPoint.cpp:16:1: error: no return statement in function returning non-void [-Werror=return-type]
 }
 ^
cc1plus: all warnings being treated as errors
/in/compile/ex2.cpp: In function 'int main()':
/in/compile/ex2.cpp:12:18: error: cannot convert 'std::vector<MyPoint>' to 'int' in initialization
     Rectangle r{m};
                  ^
/in/compile/ex2.cpp:12:18: error: missing initializer for member 'MyPoint::y' [-Werror=missing-field-initializers]
/in/compile/ex2.cpp:12:18: error: missing initializer for member 'Rectangle::bottomLeftPoint' [-Werror=missing-field-initializers]
/in/compile/ex2.cpp:12:18: error: missing initializer for member 'Rectangle::topLeftPoint' [-Werror=missing-field-initializers]
/in/compile/ex2.cpp:12:18: error: missing initializer for member 'Rectangle::topRightPoint' [-Werror=missing-field-initializers]
/in/compile/ex2.cpp:13:18: error: no matching function for call to 'Rectangle::isRect()'
     if (r.isRect()) {
                  ^
In file included from /in/compile/ex2.cpp:4:0:
/in/Rectangle.h:14:7: note: candidate: bool Rectangle::isRect(MyPoint, MyPoint, MyPoint, MyPoint)
  bool isRect(MyPoint p1, MyPoint p2, MyPoint p3, MyPoint p4);
       ^~~~~~
/in/Rectangle.h:14:7: note:   candidate expects 4 arguments, 0 provided
/in/compile/ex2.cpp:14:32: error: no matching function for call to 'Rectangle::getArea()'
         std::cout << r.getArea() << std::endl;
                                ^
In file included from /in/compile/ex2.cpp:4:0:
/in/Rectangle.h:12:6: note: candidate: int Rectangle::getArea(MyPoint, MyPoint, MyPoint, MyPoint)
  int getArea(MyPoint p1, MyPoint p2, MyPoint p3, MyPoint p4);
      ^~~~~~~
/in/Rectangle.h:12:6: note:   candidate expects 4 arguments, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h:33:0,
                 from /usr/include/c++/7/bits/allocator.h:46,
                 from /usr/include/c++/7/string:41,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/compile/ex2.cpp:1:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = MyPoint; _Args = {int&, int&}; _Tp = MyPoint]':
/usr/include/c++/7/bits/alloc_traits.h:475:4:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = MyPoint; _Args = {int&, int&}; _Tp = MyPoint; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<MyPoint>]'
/usr/include/c++/7/bits/vector.tcc:100:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int&}; _Tp = MyPoint; _Alloc = std::allocator<MyPoint>; std::vector<_Tp, _Alloc>::reference = MyPoint&]'
/in/compile/ex2.cpp:10:36:   required from here
/usr/include/c++/7/ext/new_allocator.h:136:4: error: new initializer expression list treated as compound expression [-fpermissive]
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/ext/new_allocator.h:136:4: error: no matching function for call to 'MyPoint::MyPoint(int&)'
In file included from /in/Rectangle.h:2:0,
                 from /in/compile/ex2.cpp:4:
/in/MyPoint.h:3:7: note: candidate: MyPoint::MyPoint()
 class MyPoint
       ^~~~~~~
/in/MyPoint.h:3:7: note:   candidate expects 0 arguments, 1 provided
/in/MyPoint.h:3:7: note: candidate: constexpr MyPoint::MyPoint(const MyPoint&)
/in/MyPoint.h:3:7: note:   no known conversion for argument 1 from 'int' to 'const MyPoint&'
/in/MyPoint.h:3:7: note: candidate: constexpr MyPoint::MyPoint(MyPoint&&)
/in/MyPoint.h:3:7: note:   no known conversion for argument 1 from 'int' to 'MyPoint&&'
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Homework 8
Language
C++
Submit At
2022-07-30 02:50:10
Judged At
2022-08-02 15:55:01
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes