How to create multiple files in c++ program?

Question:

how to create multiple files in c++ program???

i find error while creating multiple files in c++

can anyone pls sort it out.

Replit Profile: https://replit.com/@BALAKUMAR14

Hi @BALAKUMAR14 welcome to the community and thanks for your post.

From your screenshot and the link provided I can see that you are trying to create multiple separate programs within the same Repl. I think this is causing your issue.

Individual Repls should be used for each C++ program that has a main definition.

Hope this helps!

@BALAKUMAR14 you could use header files (.hpp) if you want multiple files.

2 Likes

I am learning the C++ program in topic wise. So I had a topic name in the folder name and file name.

how can I give likewise.

The way C++ is compiled when the “run” button is clicked it attempts to build object code for all of the C files in the Repl. This is why you see the error message.

It then runs the object code associated with main.cpp if no errors were encountered.

I really recommend you use separate Repls for each program you are coding and come up with an appropriate naming system so that you can track your progress.

1 Like

ya bro its working thanks alot bro…

If @SnakeyKing 's answer helped, you can mark that as the Solution.

1 Like

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