*

“Error: Id reverted 1 exit status (an undefined recommendation to ‘main’)” is a really 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: Id returned 1 exit status in dev c++

In this article, we will certainly talk about the Id changed 1 exit status error, the reason behind the occurrence, and a simple means to fix it. So, let’s get started!


*

What is the main() function?

Every C++ and also C program contains a causing obligation inbuilt function called main().The compiler automatically invokes the main duty and tries come compile every the code line by line from top to bottom.

Linker Error

Linker error typically occurs as soon as we attach different invalid object records with the main object file. In this error, the compiler is can not to load the executable record because the the dorn prototyping, and also incorrect header files.


Error Cause

Here are the two key causes for the error:

The user commits part mistakes while creating the key function.The main() function is not written in reduced case.

Error example:

Example 1

#include int Main() // main() is not created in lowercase printf("Welcome to neurosoup.org");return 0;Output:

: Id returned 1 exit status (undefined recommendation to ‘main’)

Example 2

#include int kain() // Mistype main() through kain() printf("Welcome to neurosoup.org");return 0;Output

: Id returned 1 departure status (undefined reference to "main")

How to resolve the Error?

To solve the error, inspect how you have actually written the main() function.The main() duty must be composed in lowercase v correct spelling.

See more: " Chill Bill Release Date

Example

Let’s fix the above-mentioned error instances by creating the code appropriately as displayed below:

#include int main() printf("Welcome come neurosoup.org");return 0;Output

Welcome come neurosoup.org

Conclusion

C and C++ are case-sensitive languages, so that is necessary to usage the exactly letter case while creating the program. The error “undefined referral to main” occurs once we mistype or misspell the main() function.