Avatar ·

Why does C++ compilation take so long? Can it be fixed?

Hi everyone! I'm a beginner C++ developer who switched from Python and JavaScript. I'm writing my first big program — a text editor with a GUI (using Qt). And I've run into a terrible problem: compilation takes forever! Here's my project: about 20 .h and .cpp files. I'm using CMake and MinGW (Windows). After every change in one .h file (for example, adding a new function or field to a class), rebuilding takes 2-3 minutes. If I change something in the main header file that is included in many modules — compilation can take 5-7 minutes. Example of my code (simplified): ```cpp // main_window.h #include #include #include #include #include #include #include #incl