Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Can't compile C++ program with extern "C" { #include mpi.h }
From: Adam C Powell IV (hazelsct_at_[hidden])
Date: 2007-12-31 21:12:45


I'm trying to build the Salomé engineering simulation tool, and am
having trouble compiling with OpenMPI. The full text of the error is at . The crux of the problem can
be reproduced by trying to compile a C++ file with:

extern "C"
#include "mpi.h"

At the end of mpi.h, the C++ headers get loaded while in extern C mode,
and the result is a vast list of errors.

It seems odd that one of the cplusplus variables is #defined while in
extern C mode, but that's what seems to be happening.

I see that it should be possible (and verified that it is possible) to
avoid this by using -DOMPI_SKIP_MPICXX. But something in me says that
shouldn't be necessary, that extern C code should only include C headers
and not C++ ones...

This is using Debian lenny (testing) with gcc 4.2.1-6.


GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6
Engineering consulting with open source tools