Extern ostream cout (& fout); Why do you use extern here?

I want to know where cout is defined. I look around and find the VC/crt/src/stl/cout.cpp file with the following code:
_ _ PURE_APPDOMAIN_GLOBAL extern _ CRTDATA2 ostream cout (& fout);
ignore those two unimportant macros, leaving
extern ostream cout (& fout);

what makes me wonder is why extern, extern is also used here to declare external variables.

CPP
Mar.26,2021

is not external, which is just the literal meaning of the keyword extern.
in practice, the intention of adding extern to a variable is to "declare but not define a variable", similar to writing a function without a function body.

Menu