I am compiling a friend's code on my machine, and I keep getting hit with this error:
$ mpic++ dummy_file_name.cpp
dummy_file_name.cpp: In member function 'bool dummy_name1::dummy_name2::python_convert(const StringMultiArray&, PyObject**)':
dummy_file_name.cpp:430:55:error: cannot convert 'const std::__cxx11::basic_string<char>' to 'const char*' for argument '1' to 'PyObject* PyString_FromString(const char*)'
PyList_SetItem(*dst, i, PyString_FromString(src[i]));
What does this mean? How can I diagnose or treat this issue? I am using the mpic++ compiler. I have tried googling this error but I have not found any fruitful information.
Here is how I built my environment:
brew reinstall gcc --without-multilib
export HOMEBREW_CC=gcc-5
export HOMEBREW_CXX=g++-5
brew install openmpi --build-form-source
brew install llvm --with-clang
It's saying it can't convert
const std::__cxx11::basic_string<char>
AKAconst std::string
toconst char*
. This is a proper error for the compiler to report. As stated above you could fix this by usingc_str()
, but that would be an awful hack, and maybe violate some component's open source license.As to why you are getting this error, it may be a mixup with the standard standard c++ libraries. You appear to be using
gcc
foropenmpi
andllvm
for the link step which is very odd. In addition, you are forcingc++11
forgcc
, but not forllvm
.Where did you get these build instructions? You may want to lookup an updated set of instructions.