To compile a program is to convert it from human-readable source code into an executable file. Compiling a program also packages assets like images and icons into the program. It is necessary to compile a program before a computer can run it.
When a developer writes a program, they do so in a programming language designed to be easy for them to write, read, and maintain. However, computers cannot run a program directly from source code — the CPU can only understand instructions in its native, low-level machine language. Compiling a program converts the instructions in the source code into a corresponding set of instructions in machine language, then encodes it into a binary executable file.
Software development kits (SDKs) include programs called compilers for developers to compile their projects. A compiler converts source code into an executable file for a single operating system and processor architecture at a time — for example, Windows on x86-64 or Unix on ARM64. Some compilers allow a developer to include machine code for multiple architectures in a single file — for example, a universal binary for macOS that can run on both Intel and Apple Silicon processors — by separately compiling for each processor architecture, then combining them into a single packaged executable.