1

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

Rachael
  • 23
  • 8
  • If `MPICXX=...` and `-std=c++11` are really on two different lines in the makefile then the `-std=c++11` line is **not** part of the `MPICC` assignment and will **not** be used during compilation. – Etan Reisner Jul 23 '15 at 21:55
  • I have tried it with them in the same line, but that also gives me an error whether it is separated by a space or a tab: g++: error: unrecognized command line option ‘-stdlib=libc++’ – Rachael Jul 24 '15 at 18:59
  • I just removed that flag, which seems to fix that particular issue. – Rachael Jul 24 '15 at 19:11

1 Answers1

0

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
wizurd
  • 3,541
  • 3
  • 33
  • 50
  • Sorry, the first one actually produces a good deal of errors. I'm switching it back for the time being. Implemented the second one, now getting the following errors: /usr/bin/ld: cannot find -lboost_mpi-mt-s /usr/bin/ld: cannot find -lboost_serialization-mt-s /usr/bin/ld: cannot find -lboost_system-mt-s /usr/bin/ld: cannot find -lboost_filesystem-mt-s – Not sure where that's coming from, /usr/bin/ld doesn't seem to be anywhere in these files. – Rachael Jul 24 '15 at 19:23
  • Turns out I had a "-s" at the end of the filename in the env file that was not in the actual filename. Everything works now. Thanks! – Rachael Jul 24 '15 at 19:54