“Error: Id went back 1 departure status (an undefined reference to ‘main’)” is a very common C and C++ linker Error. Just by looking in ~ the statement, we have the right to tell that there is one error in the main function.
You are watching: C++ id returned 1 exit status
In this article, we will certainly talk around the Id returned 1 departure status error, the reason behind the occurrence, and also a simple method to solve it. So, let’s acquire started!
What is the main() function?Every C++ and C program includes a mandatory inbuilt role called main().The compiler instantly invokes the main function and tries come compile all the password line by line from optimal to bottom.
Linker error generally occurs once we connect different invalid object papers with the key object file. In this error, the compiler is unable to load the executable file because that the dorn prototyping, and also incorrect header files.
Here are the two crucial causes for the error:The user commits some mistakes while creating the key function.The main() function is not written in lower case.
#include int Main() // main() is not composed in lowercase printf("Welcome come tacoemojishirt.com");return 0;Output:
#include int kain() // Mistype main() through kain() printf("Welcome to tacoemojishirt.com");return 0;Output
How to fix the Error?To settle the error, examine how you have written the main() function.The main() duty must be written in lowercase through correct spelling.
See more: Can Guinea Pigs Eat Red Cabbage ? Why You Should! Can Guinea Pigs Eat Cabbage
Let’s solve the above-mentioned error examples by writing the code accordingly as shown below:
#include int main() printf("Welcome come tacoemojishirt.com");return 0;Output
Welcome come tacoemojishirt.com