I recently split very large files in my C ++ project into many small files (basically one file for each class). This doubled the compilation time and also increased the resulting executable from 1.6 MB to 2.4 MB. Why has this changed so much?
Is this a direct result of including multiple headers in a large number of files, not just a few?
Compiler Options:
g ++ -Wall -Wextra -g -ggdb -std = C ++ 0x
The size of the executable I am referring to is the execution of the strip -s executable.
Dimensions:
Earlier with debugging symbols: 16 MB
After debugging characters: 26 MB
Previously without debugging symbols: 1.5 MB
After debugging characters: 2.4 MB
Additional question:
I already use precompiled headers by putting headers in pch.hpp and then using the -include pch.hpp option in my g ++ flags. Is this the best way to do this with gcc? This seems to have very little effect on compilation time. The only headers that have not been precompiled at present are different from the project and may be changed as the project is under heavy development.
goji
source share