I've just run into this chunk of code.
/* MPICH2 will fail if SEEK_* macros are defined
* because they are also C++ enums. Undefine them
* when including mpi.h and then redefine them
* for sanity.
# ifdef SEEK_SET
# define MB_SEEK_SET SEEK_SET
# define MB_SEEK_CUR SEEK_CUR
# define MB_SEEK_END SEEK_END
# undef SEEK_SET
# undef SEEK_CUR
# undef SEEK_END
# ifdef MB_SEEK_SET
# define SEEK_SET MB_SEEK_SET
# define SEEK_CUR MB_SEEK_CUR
# define SEEK_END MB_SEEK_END
# undef MB_SEEK_SET
# undef MB_SEEK_CUR
# undef MB_SEEK_END
MPICH2 (1.1.0a1) gives these errors if SEEK_* are present:
/opt/mpich2/include/mpicxx.h:26:2: error: #error "SEEK_SET is #defined but must not be for the C++ binding of MPI"
/opt/mpich2/include/mpicxx.h:30:2: error: #error "SEEK_CUR is #defined but must not be for the C++ binding of MPI"
/opt/mpich2/include/mpicxx.h:35:2: error: #error "SEEK_END is #defined but must not be for the C++ binding of MPI"
but when SEEK_* is not present and iostream has been included, OMPI-dev
gives these errors.
/home/ompi/include/openmpi/ompi/mpi/cxx/mpicxx.h:53: error: âSEEK_SETâ was not declared in this scope
/home/ompi/include/openmpi/ompi/mpi/cxx/mpicxx.h:54: error: âSEEK_CURâ was not declared in this scope
/home/ompi/include/openmpi/ompi/mpi/cxx/mpicxx.h:55: error: âSEEK_ENDâ was not declared in this scope
There is a subtle difference between OMPI 1.2.7 and -dev at least with
GCC 4.3.2. If iostream was included before mpi.h and then SEEK_* are
#undef'd then 1.2.7 succeeds while -dev fails with the message above.
If stdio.h is included and SEEK_* are #undef'd then both OMPI versions
fail. MPICH2 requires in both cases that SEEK_* be #undef'd.
What do you recommend to remain portable? Is this really an MPICH2
issue? The standard doesn't seem to address this issue. The MPICH2 FAQ
- application/pgp-signature attachment: stored