Cannot install Rcpp armadillo in R with CENTOS in CLOUDERA

I tried to install RcppArmadillo in R with Centos over cloudera VM. First, I installed gcc 5.3.0 from scratch, and then I installed R with these instructions

yum -y update

rpm -ivh http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Step 3 was installing R & R-devel

yum install R R-devel

Then, start R shell and issue commands within it to download packages as below (note that install.packages() line splits over many lines even though it is one single line till the last closing brackets(s))

R

install.packages(c(“rJava”, “Rcpp”, “RJSONIO”, “bitops”, “digest”, “functional”, “stringr”, “plyr”, “reshape2”))

But when I tried to install Rcpp Armadillo, I received this message

checking whether g++ -m64 accepts -g... (cached) yes checking whether g++ version is sufficient... no configure: WARNING: Only g++ version 4.7.2 or greater can be used with RcppArmadillo. configure: error: Please use a different compiler. ERROR: configuration failed for package ‘RcppArmadillo’ * removing ‘/usr/lib64/R/library/RcppArmadillo’

The downloaded source packages are in ‘/tmp/Rtmpp3xDqf/downloaded_packages’ Updating HTML index of packages in '.Library' Making 'packages.html' ... done Warning message: In install.packages(c("RcppArmadillo")) : installation of package ‘RcppArmadillo’ had non-zero exit status locate

I have searched how to resolve this problem in some links. For example, one suggestion consists of modifying ~/.R/Makevars, but I haven't got this file and directory created, when I installed R.

I created the file Makevars in ~/ with the entries

CXX 5.3.0
CC  5.3.0

but the effect is null.

How can I install RcppArmadillo with the compiling option of gcc 5.3.0?

Thanks a lot