Knowee
Questions
Features
Study Tools

home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:60:13: error: ‘exit’ was not declared in this scope 60 | exit(0); | ^~~~

Question

home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:60:13: error: ‘exit’ was not declared in this scope 60 | exit(0); | ^~~~

🧐 Not the exact question you are looking for?Go ask a question

Solution

The error message you're seeing is because the exit function is not recognized in your code. This function is part of the cstdlib library in C++.

To fix this error, you need to include the cstdlib library at the beginning of your code. Here's how you can do it:

  1. At the top of your Main.cpp file, add this line: #include <cstdlib>

  2. Save your changes and recompile your code.

This should resolve the error and allow your program to recognize the exit function.

This problem has been solved

Similar Questions

/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:7:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] 7 | result = (m >= 6.0 && s >= 50.5) ? "Eligible for Next Round" : (m < 6.0 || s < 50.5) ? | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | const char* 8 | "Not Eligible" : "Try again..."; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Compiler Message/home/ubuntu/Main.cpp:20:20: warning: missing terminating " character 20 | printf("Invalid type entered! | ^/home/ubuntu/Main.cpp:20:20: error: missing terminating " character 20 | printf("Invalid type entered! | ^~~~~~~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp:21:1: warning: missing terminating " character 21 | "); | ^/home/ubuntu/Main.cpp:21:1: error: missing terminating " character 21 | "); | ^~~/home/ubuntu/Main.cpp:27:20: warning: missing terminating " character 27 | printf("Integer: %d | ^/home/ubuntu/Main.cpp:27:20: error: missing terminating " character 27 | printf("Integer: %d | ^~~~~~~~~~~~/home/ubuntu/Main.cpp:28:1: warning: missing terminating " character 28 | ", *(int*)value); | ^/home/ubuntu/Main.cpp:28:1: error: missing terminating " character 28 | ", *(int*)value); | ^~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp:31:20: warning: missing terminating " character 31 | printf("Float: %.2f | ^/home/ubuntu/Main.cpp:31:20: error: missing terminating " character 31 | printf("Float: %.2f | ^~~~~~~~~~~~/home/ubuntu/Main.cpp:32:1: warning: missing terminating " character 32 | ", *(float*)value); | ^/home/ubuntu/Main.cpp:32:1: error: missing terminating " character 32 | ", *(float*)value); | ^~~~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:22:13: error: expected primary-expression before ‘return’ 22 | return 0; | ^~~~~~/home/ubuntu/Main.cpp:29:13: error: expected primary-expression before ‘break’ 29 | break; | ^~~~~/home/ubuntu/Main.cpp:33:13: error: expected primary-expression before ‘break’ 33 | break; | ^~~~~Sample TestcaseTestcase 1 - FailedExpected OutputInteger: 4OutputTestcase 2 - FailedExpected OutputFloat: 5.50OutputTestcase 3 - FailedExpected OutputInvalid type entered!

./Solution.cpp: In function 'int main()':./Solution.cpp:30:5: error: redefinition of 'int main()' int main() { ^./Solution.cpp:16:5: note: 'int main()' previously defined here int main() {

/home/ubuntu/Main.cpp: In function ‘int evaluateexpression(char*)’:/home/ubuntu/Main.cpp:29:12: error: ‘isdigit’ was not declared in this scope 29 | if(isdigit(token[0])){ | ^~~~~~~

/home/ubuntu/Main.cpp:22:5: error: expected unqualified-id before ‘delete’ 22 | int delete(){ | ^~~~~~/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:72:13: error: ‘insert’ was not declared in this scope 72 | insert(item); | ^~~~~~/home/ubuntu/Main.cpp:75:63: error: expected primary-expression before ‘)’ token 75 | printf("Element deleted from queue is :%d",delete()); | ^

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.