Record Detail

Compile Error

In file included from /in/ex6.cpp:1:0:
/in/ex6.h:115:17: error: expected ';' at end of member declaration
   std::ostream &print(ostream &os, TreeNode *node) const;
                 ^~~~~
/in/ex6.h:115:31: error: expected ')' before '&' token
   std::ostream &print(ostream &os, TreeNode *node) const;
                               ^
/in/ex6.cpp: In constructor 'BinaryTree::BinaryTree()':
/in/ex6.cpp:6:1: error: uninitialized reference member in 'std::ostream& {aka class std::basic_ostream<char>&}' [-fpermissive]
 BinaryTree::BinaryTree() : root(nullptr) {}
 ^~~~~~~~~~
In file included from /in/ex6.cpp:1:0:
/in/ex6.h:115:23: note: 'std::ostream& BinaryTree::print' should be initialized
   std::ostream &print(ostream &os, TreeNode *node) const;
                       ^~~~~~~
/in/ex6.cpp: In constructor 'BinaryTree::BinaryTree(int)':
/in/ex6.cpp:8:1: error: uninitialized reference member in 'std::ostream& {aka class std::basic_ostream<char>&}' [-fpermissive]
 BinaryTree::BinaryTree(int val) : root(new TreeNode{val, nullptr, nullptr}) {}
 ^~~~~~~~~~
In file included from /in/ex6.cpp:1:0:
/in/ex6.h:115:23: note: 'std::ostream& BinaryTree::print' should be initialized
   std::ostream &print(ostream &os, TreeNode *node) const;
                       ^~~~~~~
/in/ex6.cpp: In constructor 'BinaryTree::BinaryTree(int, const BinaryTree&, const BinaryTree&)':
/in/ex6.cpp:10:1: error: uninitialized reference member in 'std::ostream& {aka class std::basic_ostream<char>&}' [-fpermissive]
 BinaryTree::BinaryTree(int val, const BinaryTree &left, const BinaryTree &right) : root(new TreeNode{val, nullptr, nullptr})
 ^~~~~~~~~~
In file included from /in/ex6.cpp:1:0:
/in/ex6.h:115:23: note: 'std::ostream& BinaryTree::print' should be initialized
   std::ostream &print(ostream &os, TreeNode *node) const;
                       ^~~~~~~
/in/ex6.cpp: In copy constructor 'BinaryTree::BinaryTree(const BinaryTree&)':
/in/ex6.cpp:16:1: error: uninitialized reference member in 'std::ostream& {aka class std::basic_ostream<char>&}' [-fpermissive]
 BinaryTree::BinaryTree(const BinaryTree &other)
 ^~~~~~~~~~
In file included from /in/ex6.cpp:1:0:
/in/ex6.h:115:23: note: 'std::ostream& BinaryTree::print' should be initialized
   std::ostream &print(ostream &os, TreeNode *node) const;
                       ^~~~~~~
/in/ex6.cpp: In function 'std::ostream& operator<<(std::ostream&, const BinaryTree&)':
/in/ex6.cpp:159:36: error: no match for call to '(std::ostream {aka std::basic_ostream<char>}) (std::ostream&, TreeNode* const&)'
     return tree.print(os, tree.root);
                                    ^
/in/ex6.cpp: At global scope:
/in/ex6.cpp:163:57: error: no 'std::ostream& BinaryTree::print(std::ostream&, TreeNode*) const' member function declared in class 'BinaryTree'
 ostream& BinaryTree::print(ostream &os, TreeNode *node) const
                                                         ^~~~~
/in/compile/Makefile:69: recipe for target 'ex6.o' failed
make: *** [ex6.o] Error 1

Information

Submit By
Type
Submission
Homework
Exercise 6
Language
C++
Submit At
2024-12-11 22:16:04
Judged At
2024-12-11 22:16:04
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes