Skip to content
Sign upLog in
← Back to Community

multiple definition of 'main' problem (C language)

Profile icon

I wonder how to solve this problem. In my case, I am studying C language with I create folders and make each .c file for question categorization(in example folder - example1.c, example2.c, in test folder - test1.c, test2.c ...).
Maybe for this reason, I always meet this warning when running main.c - multiple definition of 'main'.
So, I try to solve this problem by commenting out the full code in each .c file. If I want to run main.c, then I comment out(/.../) other examples.c files to run main.c program.
Is there any solution for this? (sorry for not good at English and wish Everyone have a nice today!)

Profile icon
Profile icon

Make a .replit file and do run = "bash [file]"
you can put all the commands to compile each of them separately in said file.