C++: Compiler and Linker functionality

后端 未结 8 478
野趣味
野趣味 2020-12-10 08:39

I want to understand exactly which part of a program compiler looks at and which the linker looks at. So I wrote the following code:

#include          


        
8条回答
  •  轮回少年
    2020-12-10 08:45

    Ah, but you could have NonDefinedFunction(int) in another compilation unit.

    The compiler produces some output for the linker that basically says the following (among other things):

    • Which symbols (functions/variables/etc) are defined.
    • Which symbols are referenced but undefined. In this case the linker needs to resolve the references by searching through the other modules being linked. If it can't, you get a linker error.

提交回复
热议问题