[Solved] Dev-C++ reported an error [Error] ld returned 1 exit status

If you are autistic by typing the code, then let’s write the text

This time I am using Dev-C++, a problem ****:\****\****\****\collect2.exe [Error] ld returned 1 exit status , no matter how I press the F11 key to run and compile, this error will be reported. I tried to delete the latest changes, but the problem was not solved. In the end, Du Niang helped me solve the problem. It turns out that the last running black box program has not been closed, and the problem will be solved after closing. In order to prevent errors from being reported in the future, the summary is as follows:

1. Check whether the last running program is closed, if not, recompile and run after closing to solve the problem
2. There is no main function in the program, check whether your main function main() is misspelled
3. Check whether the custom function only declares the function but has no function body, or the written function body is commented out

There may also be errors reported for other reasons. At present, I only know these. If I encounter them in the future, I will update them.

If you don’t understand the above summary, you can look at a few pictures, which are easier to understand than words (corresponding to the above three situations respectively).

1. If a program is already running, an error will appear when running the program again


At the end, there will definitely be a lot of errors in writing code, but I hope everyone’s errors can be solved smoothly!