C++ Project - File Seperating

Simple Question!!!

How do i seperate files in my project

for example if having multiple .cpp and .h files in the project

instead of all the code being in main.cpp
This is a very vague question. It really depends on the design patterns you want to use and how you've designed and structured your code.
...

I just want to split large projects into multiple files

Instead of putting it all in. Main
That's still an incredibly vague and broad request.
Hi,

Normally in C++, class declarations (definitions from your other topic :+) )go into header files, while the definition of their functions go into .cpp files. Inside some .cpp file, you want to use a particular function or object from a class, then include the header file in which it belongs.

If you don't have any classes, there is nothing stopping you from gathering related functions together and doing the same thing. The fact that they are related will probably imply that they go into classes though.

http://www.cplusplus.com/doc/tutorial/


Their is also a lot of reference material & articles at the top left of this page.
Last edited on
Topic archived. No new replies allowed.