0
Is there any difference between using the include directive versus externing everything?
In Cpp, is externing all of the functions and variables and later, compiling and linking both my source and the header files the *same* as including it and using its members?
4 Antworten
+ 2
Calvin Jude your notions are all correct. Using extern indicates to the compiler that it may have to backpatch the function reference after it locates the function definition externally, but the eventual result is the same as #include of the function source or function prototype.
Using #include does simply insert the include file text into your source as part of preprocessing before compiling.
0
What exactly does the #include directive do? Does it paste the header's text in the source file and then feed it to the compiler?
0
Brian I've been reading more about header files and noticed that most of them mainly contain forward declarations for functions, with their actual implementations located in separate files. Does this also apply to iostream? If so, how is the corresponding implementation file automatically compiled and linked?
0
Do all standard headers only contain prototypes?