If you may get this error on your Linux instance, that would be you didn't installed the package g++. Will follow the steps below how to install the package in CentOS/RHEL/CloudLinux, Ubuntu/Debian and FreeBSD operating systems.

​checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking how to run the C++ preprocessor... /lib/cpp

We need to installt he dependancies on your instance,

​Execute  the following on CentOS/RHEL/CloudLinux instance:
$ sudo yum -y install gcc-c++ 

For Debian/Ubuntu:
apt-get -y install g++

For FreeBSD:
pkg install gcc