Vacassal Alsk Vacassal Alsk - 3 months ago 15
C++ Question

error in c++ regarding boost and mac upgrade

before upgrading my mac, everything works fine. After upgrade to Capitan, since openmpi becomes unusable (and I don't know why it seems only me is not able to use it in the world.) I have to switch to MPICH.

When try to compile the same program with boost mpi, serialization, etc. I got the error:

./common.h:67:23: error: expected expression
ar & t.get<0>();
^


Any help? Thank you.

Edit: t actually originates from serialization the complete code is as followed... It works in other clusters and my previous unungraded mac...

namespace boost { namespace serialization {


template<typename Archive, typename T1>

void serialize(Archive & ar,
boost::tuple<T1> & t,

const unsigned int)
{
ar & t.get<0>();
}

template<typename Archive, typename T1,typename T2>
void serialize(Archive & ar,

boost::tuple<T1,T2> & t,

const unsigned int)
{

ar & t.get<0>();
ar & t.get<1>();
}


template<typename Archive, typename T1,typename T2,typename T3>
void serialize(Archive & ar,

boost::tuple<T1, T2, T3> & t,

const unsigned int)
{

ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
}


template<typename Archive, typename T1,typename T2,typename T3 ,typename T4>
void serialize(Archive & ar,

boost::tuple<T1, T2, T3 ,T4> & t,

const unsigned int)
{

ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
}

template<typename Archive, typename T1,typename T2,typename T3 ,typename T4,typename T5>
void serialize(Archive & ar,

boost::tuple<T1, T2, T3 ,T4, T5> & t,

const unsigned int)
{

ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
ar & t.get<4>();
}

template<typename Archive, typename T1,typename T2,typename T3 ,typename T4,typename T5,typename T6 >
void serialize(Archive & ar,

boost::tuple<T1, T2, T3 ,T4, T5, T6> & t,

const unsigned int)
{

ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
ar & t.get<4>();
ar & t.get<5>();
}


template<typename Archive, typename T1,typename T2,typename T3 ,typename T4,typename T5,typename T6 ,typename T7>
void serialize(Archive & ar,

boost::tuple<T1, T2, T3 ,T4, T5, T6 ,T7> & t,

const unsigned int)
{

ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
ar & t.get<4>();
ar & t.get<5>();
ar & t.get<6>();
}


}}

Answer

I end up solving this with changing compiler back to gcc-4.8

just do

brew install gcc-4.8

And make the corresponding alias in ~/.bash_profile,

alias g++="g++-4.8"
alias gcc="gcc-4.8"

export PATH="/usr/local/sbin:$PATH"
export HOMEBREW_CC=gcc-4.8
export HOMEBREW_CXX=g++-4.8

afterwards, do:

brew install mpich --from_source
Comments