Ask coding questions

← Back to all posts
Error
saianurag (0)

I'm an absolute beginner and can anyone help me with the error.
Thanks!

Commentshotnewtop
mwilki7 (282)

you have 2 files with a "main()" function
the compiler cant figure out which one to use

you can see that the error message is describing where the error is for you:
main1.c:(.text+0x0): multiple definition of 'main'

KelvinVerhey (33)

@mwilki7 @saianurag this is a correct.

Make sure you delete main1.c from the project and it will compile. That is a direct copy of main.c and as mentioned puts two main() functions in the project. The compiler can only sort out one entry for a program.

99andri12 (0)

try to remove the void inside the main parentheis
and add a return to the end of the function like return 0;

saianurag (0)

@99andri12 still getting the same error