Chapter 1. Hello, World!
Humans write code, but computers understand only 0s and 1s, so code needs to be “translated” for the computer. Some languages, like Python and JavaScript, are interpreted, meaning that the tools read the code and decide what to do dynamically, meaning at runtime. Every time such code is run, it must be reinterpreted.
Other languages, like Java and C#, compile to an intermediate language, for example, bytecode for Java. The output Lis interpreted by a virtual machine, so you can compile your code once and run it almost anywhere. This is more efficient than interpreting code every time it is run, because the initial transformation step needs happen only once.
C++ is different, though it follows a process used by C, Fortran, and several other languages. C++ source code is transformed directly into something the computer understands. When you build C++ code, two steps happen.
First, a compiler reads your code and produces object files that are specific to your target machine, such as 32-bit Windows, 64-bit Linux, or an embedded system. If you want your code to run on a different machine, you need to rebuild it. For a small program, the object files produced by the compiler might stay in memory; for a larger program, you are likely to see them, often with the extensions *.o or *.obj, generated on your machine.
Second, the linker stitches the object files together to produce a library, which you can use in another codebase, or program that you can run directly. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access