CentOS / Linux – make: g++: Command not found – How to fix How to fix this common Linux terminal error by installing GCC, the GNU Compiler Collection

CentOS / Linux - make: g++: Command not found - How to fix

If you’ve stumbled upon this post it probably means that you were trying to compile a C++ program using the linux make  terminal command and ran into the following error:

> make: g++: Command not found

Or maybe the following one, depending on the Linux version and distribution you’re using:

> “/bin/sh: g++: command not found”

Luckily enough, the fix is really simple: all you have to do is to install GCC, the GNU Compiler Collection package, which enables full C++ compilation support for most modern Linux distributions (here’s the last changelog).

Here’s the command that will solve your issue for good:

If you’re not running CentOS or another yum-based distribution, you can achieve the following results

That’s it for now: happy building!

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

One Comment on “CentOS / Linux – make: g++: Command not found – How to fix How to fix this common Linux terminal error by installing GCC, the GNU Compiler Collection

  1. On Ubuntu Desktop 20.04, sudo apt install gcc didn’t work, because it doesn’t automatically include g++. I needed to run sudo apt install build-essentials.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.