What is the solution for error: redefinition of 'main' in C?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aneesa khan
    New Member
    • Oct 2019
    • 1

    What is the solution for error: redefinition of 'main' in C?

    It gives me an error when I try to write another program on the same source file that I used for a program before. the error is error: redefinition of 'main'. What should I do?
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Most likely, your source file contains two functions named main. You can’t have two functions with the same name in the same source file.

    Comment

    • dev7060
      Recognized Expert Contributor
      • Mar 2017
      • 655

      #3
      Also, you may need to check the source files that are being included in the current one.

      Comment

      Working...