You are previewing The Linux Command Line.

The Linux Command Line

Cover of The Linux Command Line by William E. Shotts Jr. Published by No Starch Press
O'Reilly logo

Compiling a C Program

Let’s compile something. Before we do that, however, we’re going to need some tools like the compiler, the linker, and make. The C compiler used almost universally in the Linux environment is called gcc (GNU C Compiler), originally written by Richard Stallman. Most distributions do not install gcc by default. We can check to see if the compiler is present like this:

[me@linuxbox ˜]$ which gcc

The results in this example indicate that the compiler is installed.


Your distribution may have a metapackage (a collection of packages) for software development. If so, consider installing it if you intend to compile programs on your system. If your system does not provide a metapackage, try installing the gcc and make ...

The best content for your career. Discover unlimited learning on demand for around $1/day.