I'm trying to compile a program with openmpi, my code does not give any errors but instead one of the mpi headers does:
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/mpicxx.h:168: error: expected identifier before numeric constant
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/mpicxx.h:168: error: expected unqualified id before numeric constant
The relevant line of code in the header simply reads:
namespace MPI {
I am using the mpiCC compiler. Am I doing something wrong? or is this a bug in openmpi?
Thanks in advance.
Though I am not able to reproduce the problem you encountered, the following comments can be found in mpi.h
, from which mpicxx.h
is included:
/*
* Conditional MPI 2 C++ bindings support. Include if:
* - The user does not explicitly request us to skip it (when a C++ compiler
* is used to compile C code).
* - We want C++ bindings support
* - We are not building OMPI itself
* - We are using a C++ compiler
*/
#if !defined(OMPI_SKIP_MPICXX) && OMPI_WANT_CXX_BINDINGS && !OMPI_BUILDING
#if defined(__cplusplus) || defined(c_plusplus)
#include "openmpi/ompi/mpi/cxx/mpicxx.h"
#endif
#endif
If you are not using the deprecated C++ bindings, then a possible workaround is to add
-DOMPI_SKIP_MPICXX
to your CXXFLAGS
. Hope this may help.