GCC 4.8.4 Error on Ubuntu 14.04 VM: -std=c++11 flag isn't being detected

530 Views Asked by At

I've looked everywhere online and can't seem to find a solution to this issue. I have tried -std=c++11, -std=c++0x, and -std=c++1y flags in the makefile and env file, all of which have no effect on the following errors:

'to_string' is not a member of 'std'
range based 'for' loops are not allowed in C++98 mode

I am trying to run a C++ program built on top of RepastHPC, which is running on an Ubuntu 14.04 VirtualBox VM. Both the makefile for RepastHPC itself and the env file for the C++ code contain the flag. The env file is used in the makefile for the C++ code, so it isn't missing from there.

# Repast HPC 
# ENVIRONMENT DEFINITIONS

MPICXX=/home/repasthpc/repast_hpc-2.1.0/INSTALLATION/mpich-3.1.4/src/env/mpicxx
-std=c++11 -D USE_CPP11 -stdlib=libc++

BOOST_INCLUDE=-I/usr/local/include/
BOOST_LIB_DIR=-L/usr/local/lib/
BOOST_LIBS=-lboost_mpi-mt-s -lboost_serialization-mt-s -lboost_system-mt-s -lboost_filesystem-mt-s

REPAST_HPC_INCLUDE=-I/usr/local/include/
REPAST_HPC_LIB_DIR=-L/usr/local/lib/
REPAST_HPC_LIB=-lrepast_hpc-2.1

TISSUE_INCLUDE=-I/Users/repasthpc/Desktop/hpcmodel/angiogenesis_osteogenesis_simulator/src/

------------------------------------------------------------

# Repast HPC
# MANUAL BUILD MAKEFILE

# VARIABLES (Supply values for these; for definitions and examples, see INSTALL)
CXX=mpicxx      -std=c++11 -D USE_CPP11
CXXLD=mpicxx
BOOST_INCLUDE_DIR=/usr/local/include
BOOST_LIB_DIR=/usr/local/lib
BOOST_INFIX=-mt
NETCDF_INCLUDE_DIR=/usr/local/include
NETCDF_LIB_DIR=/usr/local/lib
CURL_INCLUDE_DIR=/usr/local/include
CURL_LIB_DIR=/usr/local/lib

** This is not the end of the makefile, but it is the end of the relevant section **

Any thoughts? I am thoroughly confused.

Thanks! Rachael

1

There are 1 best solutions below

2
wizurd On BEST ANSWER

Just a couple issues with this Makefile:

1)CXX=mpicxx does not do what you are intending.

The correct way to do this is

CXX=$(MPICXX)

This translates to:

CXX=/home/repasthpc/repast_hpc-2.1.0/INSTALLATION/mpich3.1.4/src/env/mpicxx

2) Also notice that the -std=c++11 -D USE_CPP11 -stdlib=libc++ part is not included in CXX above. This is because we need a '\' to tell Make that there is another line as well.

So try this:

MPICXX=/home/repasthpc/repast_hpc-2.1.0/INSTALLATION/mpich-3.1.4/src/env/mpicxx \
-std=c++11 -D USE_CPP11 -stdlib=libc++

BOOST_INCLUDE=-I/usr/local/include/
BOOST_LIB_DIR=-L/usr/local/lib/
BOOST_LIBS=-lboost_mpi-mt-s -lboost_serialization-mt-s -lboost_system-mt-s -lboost_filesystem-mt-s

REPAST_HPC_INCLUDE=-I/usr/local/include/
REPAST_HPC_LIB_DIR=-L/usr/local/lib/
REPAST_HPC_LIB=-lrepast_hpc-2.1

TISSUE_INCLUDE=-I/Users/repasthpc/Desktop/hpcmodel/angiogenesis_osteogenesis_simulator/src/

------------------------------------------------------------

# Repast HPC
# MANUAL BUILD MAKEFILE

# VARIABLES (Supply values for these; for definitions and examples, see INSTALL)
CXX=$(MPICXX)      -std=c++11 -D USE_CPP11
CXXLD=$(MPICXX)
BOOST_INCLUDE_DIR=/usr/local/include
BOOST_LIB_DIR=/usr/local/lib
BOOST_INFIX=-mt
NETCDF_INCLUDE_DIR=/usr/local/include
NETCDF_LIB_DIR=/usr/local/lib
CURL_INCLUDE_DIR=/usr/local/include
CURL_LIB_DIR=/usr/local/lib