I was wondering if I include a library file which contains say 5 functions and I only use 1 of them, will the rest of the functions compile too?
Asked
Active
Viewed 285 times
0
-
2Depends of the compiler/linker. What tools are you using? – chux - Reinstate Monica Dec 07 '18 at 07:05
-
1It depends on the compiler. This question was asked [here](https://stackoverflow.com/questions/6215782/do-unused-functions-get-optimized-out). – Tymoteusz Jankowski Dec 07 '18 at 07:06
-
1If you use a library, the functions are already compiled. I think there's some terminology confusion here. – molbdnilo Dec 07 '18 at 07:07
-
2@molbdnilo he probably wants to know if the unused functions will be in the final executable or not. – Jabberwocky Dec 07 '18 at 07:09
-
1It will compile whole code, assume of a scenario, you have 5 function, you are using only 4, and try giving a wrong syntax in the 5th one, you will get compilation error right? Hence it will compile all, it may not execute it. – Ashish Kumar Dec 07 '18 at 07:52
-
@Jabberwocky exactly – Abhyas29 Aug 01 '19 at 08:49