Start with C on Ubuntu 22.04 (Jammy Jellyfish).

Author
By Darío Rivera
Posted On in Ubuntu

Starting to program in C on Ubuntu is relatively simple. Generally, all the necessary packages to compile and run programs in C are included or installed by installing another library. In this post, you will see what you need to install to start programming in C, from the compiler to the IDE.

Compiler Installation

In Linux, generally, we use the GNU compiler or GCC which can be installed with the following command.

sudo apt-get install gcc

Another widely used compiler is based on LLVM.

sudo apt-get install clang

You can also install other compilers, later you will see that there is a very long list of options that you can use.

IDE Installation

One of the most used IDEs in Ubuntu is Codeblocks. To install it, just run the following command:

sudo apt-get install codeblocks

When you start codeblocks for the first time, it will ask you for your preferred compiler. This value can always be changed in Settings > Compiler, as you can see in the following image.

Compiler choices in Codeblocks

C Header Files

In Linux, it is very easy to identify header files, as these are located in the directories /usr/include and /usr/local/include. In Ubuntu, we can see all these files with extension .h with the following command:

find /usr/include/ -maxdepth 1 -name '*.h' -printf '%P\n' | column

You will get an output like the following:

Output of C header files on Linux


Acerca de Darío Rivera

Author

Application Architect at Elentra Corp . Quality developer and passionate learner with 10+ years of experience in web technologies. Creator of EasyHttp , an standard way to consume HTTP Clients.

LinkedIn Twitter Instagram

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.