Advertisement
ThePixeLady

Stack Error

May 16th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. try{
  2. if(intStack.push(word)){
  3. throw DatatypeError("Invalid Datatype");}
  4. }catch (DatatypeError& error){
  5. std::cout << "Exception: " << error.what() << std::endl;
  6. }
  7.  
  8. ERRROR
  9.  
  10. /cygdrive/d/Advanced C++/03/main.cpp: In function 'int main()':
  11. /cygdrive/d/Advanced C++/03/main.cpp:173:12: warning: init-statement in selection statements only available with -std=c++1z or -std=gnu++1z
  12. if(intStack.push(word);){
  13. ^~~~~~~~
  14. /cygdrive/d/Advanced C++/03/main.cpp:173:30: error: no matching function for call to 'Stack<int>::push(std::string&)'
  15. if(intStack.push(word);){
  16. ^
  17. In file included from /cygdrive/d/Advanced C++/03/main.h:11:0,
  18. from /cygdrive/d/Advanced C++/03/main.cpp:13:
  19. /cygdrive/d/Advanced C++/03/Stack.h:23:10: note: candidate: void Stack<stackType>::push(stackType) [with stackType = int]
  20. void push (stackType x);
  21. ^~~~
  22. /cygdrive/d/Advanced C++/03/Stack.h:23:10: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'int'
  23. /cygdrive/d/Advanced C++/03/main.cpp:173:32: error: expected primary-expression before ')' token
  24. if(intStack.push(word);){
  25. ^
  26. make[3]: *** [CMakeFiles/03.dir/build.make:63: CMakeFiles/03.dir/main.cpp.o] Error 1
  27. make[3]: *** Waiting for unfinished jobs....
  28. make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/03.dir/all] Error 2
  29. make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/03.dir/rule] Error 2
  30. make: *** [Makefile:118: 03] Error 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement