I have a c++ program file with two functions in it. If I change the first function alone, why should both of them have to be recompiled? Is there any build system which recompiles the first one alone and put it back in the same object file? Is this possible? The instructions of one function shouldn't depend on other right? Since gmake recompiles the whole file, it takes a lot of time, cant this be avoided? Putting the second function in a separate file is not a good idea, as it involves creation of unwanted files which is not necessary.
If the second function is quite long or requires more time to compile, place it in a separate file. That is why people separate source files. From what I know, it has to compile the whole file, as a small change in the source will result in a major change in the output file, as the functions would not link to each other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With