Skip to content
Advertisement

Multiple instances of main method in C

I’ve got an issue with an assignment, but I’m not asking for help to do the assignment, just single problem.

My code is like this:

JavaScript

Here’s the problem: When I do the make command from the directory, I get the error

JavaScript

What does this error mean? I only defined the main method one time in my own file

Advertisement

Answer

The message says you have (at least) two C files, main.c and file_i_created.c that are included in the build. Both have main() functions. (In C, the term is “function”, not “method”.) Remove one of those source files, or remove/rename the main() function in one of them.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement