Record Detail

Compile Error

/in/compile/ex2.cpp: In function 'int main()':
/in/compile/ex2.cpp:12:18: error: no matching function for call to 'Rectangle::Rectangle(<brace-enclosed initializer list>)'
     Rectangle r{m};
                  ^
In file included from /in/compile/ex2.cpp:4:0:
/in/Rectangle.h:10:7: note: candidate: Rectangle::Rectangle()
 class Rectangle
       ^~~~~~~~~
/in/Rectangle.h:10:7: note:   candidate expects 0 arguments, 1 provided
/in/Rectangle.h:10:7: note: candidate: Rectangle::Rectangle(const Rectangle&)
/in/Rectangle.h:10:7: note:   no known conversion for argument 1 from 'std::vector<MyPoint>' to 'const Rectangle&'
/in/Rectangle.h:10:7: note: candidate: Rectangle::Rectangle(Rectangle&&)
/in/Rectangle.h:10:7: note:   no known conversion for argument 1 from 'std::vector<MyPoint>' to 'Rectangle&&'
/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:18:12: note: candidate: double Rectangle::getArea(Rectangle)
     double getArea(Rectangle);
            ^~~~~~~
/in/Rectangle.h:18:12: note:   candidate expects 1 argument, 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:8:0,
                 from /in/compile/ex2.cpp:4:
/in/MyPoint.h:10:7: note: candidate: MyPoint::MyPoint()
 class MyPoint
       ^~~~~~~
/in/MyPoint.h:10:7: note:   candidate expects 0 arguments, 1 provided
/in/MyPoint.h:10:7: note: candidate: constexpr MyPoint::MyPoint(const MyPoint&)
/in/MyPoint.h:10:7: note:   no known conversion for argument 1 from 'int' to 'const MyPoint&'
/in/MyPoint.h:10:7: note: candidate: constexpr MyPoint::MyPoint(MyPoint&&)
/in/MyPoint.h:10:7: note:   no known conversion for argument 1 from 'int' to 'MyPoint&&'

Information

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