Multiple definitions of “Main”

前端 未结 1 1742
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 20:31

In the journey to learning C++ im learning through the C++ Manual thats on the actual website. Im using DevC++ and have hit a problem, not knowing whether its the compilers

相关标签:
1条回答
  • 2021-01-18 21:21

    Multiple definitions of "main" suggests that you have another definition of main. Perhaps in another .c or .cpp file in your project. You can only have one function with the same name and signature (parameter types). Also, main is very special so you can only have one main function that can be used as the entry point (has either no parameters, one int, or an int and a char**) in your project.

    P.S. Technically this is a linker error. It's a subtle difference, but basically it's complaining that the linker can't determine which function should be the entry point, because there's more than one definition with the same name.

    0 讨论(0)
提交回复
热议问题