I've Googled this, but most of the results are about compiler A vs. compiler B.
This question arises from my experience with Web Design (know the languages commonly used on Web Design aren't compiled. CGI is an exception.) When you include file in a web page the entire file is downloaded to the user's computer. If you use JQuery, a JavaScript library, you must include JQuery in the <head>
in order to use its functions. This got me thinking about C++ compilers.
In C++ it's practically impossible to program without #include <library>
. Are the libraries compiled along with the project files? Is the
For example, in this simple Hello Word program #include <iostream>
, is all of the code in the iostream header file compiled? Will taking ONLY the code that defines cout
and adding it to this example make the size of the file smaller? Does compiler optimization take care of only compiling the necessary code from iostream
?
#include <iostream>
int main()
{
std::cout<<"Hello World.";
return 0;
}