Record Detail

Compile Error

In file included from /in/ex5.cpp:1:0:
/in/compile/ex5.h: In constructor 'bookInventory::bookInventory()':
/in/compile/ex5.h:41:16: error: 'bookInventory::size' will be initialized after [-Werror=reorder]
   unsigned int size;
                ^~~~
/in/compile/ex5.h:37:16: error:   'unsigned int bookInventory::numBooks' [-Werror=reorder]
   unsigned int numBooks;
                ^~~~~~~~
/in/ex5.cpp:5:1: error:   when initialized here [-Werror=reorder]
 bookInventory::bookInventory(): empty(true),size(MAX_BOOKS),numBooks(0)
 ^~~~~~~~~~~~~
In file included from /in/ex5.cpp:1:0:
/in/compile/ex5.h: In constructor 'bookInventory::bookInventory(int)':
/in/compile/ex5.h:39:8: error: 'bookInventory::empty' will be initialized after [-Werror=reorder]
   bool empty;
        ^~~~~
/in/compile/ex5.h:37:16: error:   'unsigned int bookInventory::numBooks' [-Werror=reorder]
   unsigned int numBooks;
                ^~~~~~~~
/in/ex5.cpp:11:1: error:   when initialized here [-Werror=reorder]
 bookInventory::bookInventory(int maxBooks): empty(true),numBooks(0)
 ^~~~~~~~~~~~~
/in/ex5.cpp: In member function 'bool bookInventory::repOK()':
/in/ex5.cpp:34:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if(key!=numBooks)return false;   
        ~~~^~~~~~~~~~
/in/ex5.cpp: In member function 'void bookInventory::addBook(const Book&)':
/in/ex5.cpp:44:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if(numBooks>=int(size)-1) throw Exception("The inventory is full.");
        ~~~~~~~~^~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
/in/compile/Makefile:26: recipe for target 'ex5.o' failed
make: *** [ex5.o] Error 1

Information

Submit By
Type
Submission
Homework
Exercise 5
Language
C++
Submit At
2024-11-28 20:34:28
Judged At
2024-11-28 20:34:28
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes