LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Brian Barrett (brbarret_at_[hidden])
Date: 2004-09-28 09:47:24


On Sep 28, 2004, at 9:31 AM, Kevin Kuo wrote:

> Last time I posted a message about some compile errors in constants.h
> included with lam-7.0.6. One of those errors was in our code, but the
> other one remains unresolved:
>
> /usr/local/lam-7.0.6/include/mpi2cxx/constants.h:129: declaration does
> not declare anything
>
> The offending line is:
>
> extern const Datatype COMPLEX;
>
> if I comment this out it will continue to compile.

Do you happen to #define COMPLEX to something in your code? That line
is perfectly valid C++ - we are declaring a const Datatype object named
COMPLEX, in the MPI namespace. C Preprocessors aren't namespace aware,
so if you have a #define COMPLEX somewhere, that could be what is going
on. If you don't think you do, try looking at the output of the
preprocessor and see what it is turning that line into.

> And so I still have a question: is it okay to use COMPLEX and
> DOUBLE_COMPLEX in C++ code, even though C++ doesn't have native
> support for complex datatypes? One of the codes we are using does use
> it, but the compiler complains that the symbol is not defined (this is
> using lam's mpicxx).

C++ actually does have support for complex in the standard library.
The MPI::COMPLEX datatype should be used when sending a complex<float>
(and MPI::DOUBLE_COMPLEX for complex<double>, and
MPI::LONG_DOUBLE_COMPLEX for complex<long double>).

Hope this helps,

Brian

-- 
   Brian Barrett
   LAM/MPI developer and all around nice guy
   Have a LAM/MPI day: http://www.lam-mpi.org/