Linux C C H Dev Tools

  1. Here are five C-related projects - compilers, libraries, and support tools - that caught our eye recently, whether for bolstering existing projects or starting new ones.
  2. Sep 30, 2015 Installing C, C Compiler and Development Tools (build-essential) If your system don’t have build-essential package installed in your system by default, you can install the latest available version from the default distribution repositories as follows.
  3. Mar 21, 2015  Install C C Compiler and Development Tools in RHEL/CentOS and Fedora Read Also: Install C, C and Build Essential Tools in Debian/Ubuntu/Mint In this article we will explain how to install Gnu C and C compilers and it’s related Development tools such as automake, autoconf, flex, bison, etc. In Fedora and CentOS / RHEL systems.
  4. Mar 07, 2020 Run the following command to install Development Tools in Fedora system. Development Tools: These tools include general development tools such as git and CVS. C Development Tools and Libraries: These tools include core development tools such as automake, gcc and debuggers.

Nowadays, as a system administrator or engineer you can’t feel satisfied by knowing how to use the CLI and troubleshoot GNU/Linux servers, but will need to go one step further into the development area as well to stay at the top of your game. If you’re considering a career in kernel development or applications for Linux, then C or C++ is the best place to start.

Install C C++ Compiler and Development Tools in RHEL/CentOS and Fedora

Read Also: Install C, C++ and Build Essential Tools in Debian/Ubuntu/Mint

In this article we will explain how to install Gnu C and C++ compilers and it’s related Development tools such as automake, autoconf, flex, bison, etc. in Fedora and CentOS / RHEL systems.

May 29, 2018 Ubuntu Linux Install GNU GCC Compiler and Development Environment. Debian Linux Install GNU GCC Compiler and Development Environment. CentOS / RHEL 7: Install GCC (C and C Compiler) and Development Tools. Download and Install C, C Compiler on Red Hat Enterprise Linux 5 (RHEL).

What is Compiler?

In simple words, a compiler is a software program that transforms statements written in a source language into a target language that the machine’s CPU can understand and execute.

In Fedora and derivatives (actually, that is true for the entire Linux distro ecosystem as well), the most well-known C and C++ compilers are gcc and g++, respectively, both developed and supported actively by the Free Software Foundation as part of the GNU project.

Installing GCC (C++ Compiler and Development Tools

If gcc and / or g++ and it’s related Development Tools are not installed in your system by default, you can install the latest available from the repositories as follows:

Before we dive into writing C or C++ code, there’s another tool to boost your development toolset that we want to show you.

Speeding up C and C++ Compilations in Linux

When you as part of the development process, have to recompile several times after making changes to the source code it’s great to have a compiler cache to speed up future recompilations.

In Linux, there’s an utility called ccache, which speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. Besides C and C++, it also supports Objective-C and Objective-C++.

Ccache has only a few limitations: it’s only useful while recompiling a single file. For other types of compilations, the process will end up running the actual compiler. The same thing happens if a compiler flag is not supported. The bright side is that in any event it will not interfere with the actual compilation and will not throw an error – just fall back to the actual compiler.

Let’s install this tool:

and see how it works with an example.

Testing GNU C Compiler with a simple C++ Program

As an example, let’s use a simple C++ program that calculates the area of a rectangle after its length and width have been provided as inputs.

Open your favorite text editor and enter the following code, then save as area.cpp:

To compile the above code into an executable named area in the current working directory use the -o switch with g++:

If you want to take advantage of ccache, just prepend the above command with ccache, as follows:

Tools

Then run the binary:

Sample Output

Don’t let this simple example make you think that ccache is not useful. You will come to know what a great tool ccache is when recompiling a large source code file. The same principle applies for C programs as well.

Summary

In this article we have explained how to install and use the GNU compilers for C and C++ in Fedora-based distributions.

In addition, we showed how to use a compiler cache to speed up recompilations of the same code. While you can refer to the online man pages for gcc and g++ for further options and examples, we look forward to hearing from you if you have any questions or comments.

Most Linux system administrators and engineers are required to know some basic programming to help them in their daily tasks. If they want to go one step further into the development area as well (either as kernel or application programmers), then C or C++ is the best place to start.

Read Also: Install C, C++ and Development Tools in RHEL/CentOS/Fedora

In this article we will explain how to install C and C++ compilers and it’s Development Tools (build-essential) related packages such as make, libc-dev, dpkg-dev, etc. in Debian and derivatives such as Ubuntu and Linux Mint.

How to get back to mac os from boot camp 2017

The build-essential software contains an informational list of software’s which are treated as important for building Debian packages including gcc compiler, make and other needed tools.

​What is a Compiler?

Simply put, a compiler is a software program that processes instructions written in a programming language and creates a binary file that the machine’s CPU can understand and execute.

Linux C C H Dev Tools Catalog

In Debian-based distributions, the most well-known C and C++ compilers are gcc and g++, respectively. Both programs were developed and are still maintained by the Free Software Foundation through the GNU project.

​Installing C, C++ Compiler and Development Tools (build-essential)

If your system don’t have build-essential package installed in your system by default, you can install the latest available version from the default distribution repositories as follows:

Now we’re ready to start typing C or C++ code… or almost. We’re about to show you yet another tool to boost your development toolset.

Speeding Up C and C++ Compilations

When you know you’ll need to compile a program, make changes, then recompile again it’s great to have a tool like ccache, which as you will probably guess based on its name, is a compiler cache.

Dev C++ Program Download

It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. Besides C and C++, it also supports Objective-C and Objective-C++. The only limitations are:

  1. Only supports caching the compilation of a single C/C++/Objective-C/Objective-C++ file. For other types of compilations (multi-file compilation, linking, to name a few examples), the process will end up running the real compiler.
  2. Some compiler flags may not supported. If such a flag is detected, ccache will silently fall back to running the real compiler.

Let’s install this tool:

Install CCache in Debian

In the next section we will see some examples of C and C++ code compilation with and without ccache.

Testing C and C++ with a sample Program

Let’s use the classical example of a very basic C program that adds two numbers. Open your favorite text editor and enter the following code, then save as sum.c:

To compile the above code into an executable named sum in the current working directory use the -o switch with gcc:

If you want to take advantage of ccache, just prepend the above command with ccache, as follows:

Then run the binary:

While this basic example does not allow us to see the full power of ccache, for larger programs you’ll quickly realize what a great tool it is. The same applies for C++ programs as well.

Summary

In this guide we have shown how to install and use the GNU compilers for C and C++ in Debian and derivatives. In addition, we explained how to use a compiler cache to speed up recompilations of the same code. While you can refer to the online man pages for gcc and g++ for further options and examples, don’t hesitate to drop us a note using the form below If you have any questions or comments.