Main() program duplicate causing an error

I am just starting using C++. I ran the “Hello World” program with no problem. Then I try to write a small program with no syntax errors. It gives me error that there is a duplicate main(). It is probably something simple I’m not doing. Any advise?

Hello @WLWaters!

Can you give us a Repl link please?

1 Like

Welcome to Ask! You can’t have two functions with the same name in any programming language that I know of. Do you have two functions called “main”? Also could you provide us with the link to your Repl?

Even after renaming the main.cpp?

Please provide us with the link to your Repl so we can take a look.

1 Like

Your program currently crashes because there is no file called main.cpp and that is what Replit is trying to run.


Thanks. That’s the problem. I’ll continue my learning. I’m sure I will have other questions.


It looks like @CoderElijah was able to resolve your question so I’ve marked it as a solution. Marking an answer as a solution helps community members in the future find answers faster!
If you are still having trouble with your original question in the topic, go ahead and unmark the solution.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.