Whats the best way to split large cpp files into seperate ones ?

Hello I've been coding in c++ for about 3 years and always written my code in one big file rather then separating it.

I felt it was easier but I'm tired of scrolling miles to get to a certain part of the source file so how can I easily and simply split my c++ source files what code is required to do it and what should I split?.
Last edited on
closed account (o3hC5Di1)
Hi there,

What is quite common is that people make a separate file for every class.
In fact, you create two files for every class: one header file containing the declaration and one cpp file containing the actual definition (assuming it is a not a class template).

If you have a quick google for "C++ header files" or "C++ multiple files" there are numerous tutorials out there on the subject that explain the subject much better than I could.

All the best,
NwN
The easiest way to split a huge file into separate ones is to use its listing as tissue.:)
Last edited on
Topic archived. No new replies allowed.