When compiling a project in the main.cpp file, an error occurs:

Error: ld returned 1 exit status

in path C: \ directory \ proj \ collect2.exe [Error] ld returned 1 exit status

Moreover, the proj folder was created by itself in the folder with *cpp and *.h at compile time. And there is no collect2.exp file there.

  • Check all compiler messages. Perhaps when compiling or working with the linker, an error occurred that prevented the creation of a load module. - Vlad from Moscow
  • @Vlad ... \ main.o In function ZStorSt13_Ios_OpenmodeS_': ...\main.cpp multiple definition of main' ... \ proj \ collect2.exe [Error] ld returned 1 exit status These are the errors - Order_By
  • You must have one definition of the function main, and you cannot call it recursively. Therefore, check whether main calls itself. - Vlad from Moscow
  • one
    Not "can", and so it is. And it's not just main() , there can be no more than one function with the same name (and the same signatures, but this is not the case with main() , it should always be the same) - PinkTux
  • one
    You do not need main() 2 times. No one needs it more than once. This is the only entry point into the program, and the second can not be. - PinkTux

0