Compilation error when created 2 files in 1 folder

I am unable to run prog2.cpp in which i have used int main whike running the file its giving error that main function is defined in prog1.cpp also but i dont want to run prog1.cpp at that time.

** 100 days of code challange - Replit:**



code snippet

:wave: Hey @AmiteshMishra2, welcome to the forums!

You cannot have two C++ files with a main function in one Repl. It will always throw that error. Please just create new Repls for each new file you want to run.


You can use header files (.hpp) for multiple cpp files.

1 Like