> Would it break anything if I put everything before the main function into a header file (main.h)
> and then #include just that header file before the main function?
No, it won't break anything. Though it may make the code slightly less readable (two files to read/maintain instead of one, ideally small, file).
There is a school of thought which suggests that the component containing main() should be a small component responsible for setting program-wide policy (for example, a default handlers for std::bad_alloc or seeding the legacy random number generator if one is used) and then delegating the program logic to other components. In this case, it wouldn't be having a long list of preprocessor directives.
github is the name of the biggest garbage dump in the universe; though it is one in which we can find diamonds if we know where to look for them.