[mpich-discuss] function declaration conflicts in mpicxx.h

Dave Goodell goodell at mcs.anl.gov
Mon Jan 25 13:32:55 CST 2010


Are you including `mpi.h' in an `extern "C" {}' block?  If so, move it  
outside of the extern block.  MPICH2's mpi.h includes an `extern  
"C" {}' block internally around the normal C API, so you don't need to  
do it yourself.

I can't remember off the top of my head if this is required behavior  
according to the MPI Standard, but it looks like OpenMPI does the same  
thing.

-Dave

On Jan 22, 2010, at 11:34 PM, Yang Xin wrote:

> I resend my mail to the mail list due to the last one is pending for  
> administrator's review. Please help, thanks very much.
>
> Regards,
> Xin
>
> On Fri, Jan 22, 2010 at 11:04 PM, Yang Xin <zincumyx at gmail.com> wrote:
> Hi all,
>
>   I am new to MPI programming, and stacking in a conflict problem  
> during compiling. Declarations of function MPI::Init(int&, char**&)  
> and MPI::Init(), which are in mpicxx.h, conflict when my codes  
> include mpicxx.h. The following is the compile command:
>
>   "g++  -I/home/zincum/apps/mpich2/include -I. -I/home/zincum/apps/NF 
> +GrACE/GrACE/include  -I/home/zincum/apps/HDF4/include -I/home/ 
> zincum/apps/NF+GrACE/GrACE/packages/vampire/include -DBEOWULF_ABSOFT  
> -DWant_c_files  -DANSI_HEADERS  -g -c CommServer.cpp"
>
>   Other compilers, such as gcc, mpicc, mpiCC, mpicxx, have been  
> tried, but none works.
>
>   Here is the detail error message:
>
>   "/home/zincum/apps/mpich2/include/mpicxx.h:2683: error:  
> declaration of C function void MPI::Init(int&, char**&) conflicts with
>    /home/zincum/apps/mpich2/include/mpicxx.h:2682: error: previous  
> declaration void MPI::Init() here
>    /home/zincum/apps/mpich2/include/mpicxx.h:2685: error:  
> declaration of C function int MPI::Init_thread(int&, char**&, int)  
> conflicts with
>    /home/zincum/apps/mpich2/include/mpicxx.h:2684: error: previous  
> declaration int MPI::Init_thread(int) here
>   "
>
>   Thanks in advance.
>
> Regards,
> Xin
>
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss



More information about the mpich-discuss mailing list