[mpich-discuss] Compiling with mpich2`

Dave Goodell goodell at mcs.anl.gov
Tue Jan 25 13:31:47 CST 2011


Not that I know of.  Your compiler is complaining about C++ functions as "C function"s, which leads me to believe that it is trying to compile code from mpicxx.h (included by mpi.h) as C code instead of C++ code.

Assuming you are using g++, you can also check the code after the preprocessor has been run on the .C file by passing "-save-temps" to mpicxx.  This will create a post-processed "foo.ii" for a "foo.C" source file.  Then look for `extern "C" {...}" in that output where it might be affecting the mpicxx.h inclusion.

-Dave

On Jan 25, 2011, at 1:08 PM CST, Norman Lo wrote:

> Thank you for your suggestion.
> 
> I don't see any mpi.h included in any extern "C" {} blocks. Could there be other reasons ?
> 
> Thanks,
> 
> Norman
> 
> On 01/25/2011 10:13 AM, Dave Goodell wrote:
>> How are you including "mpi.h" in your code?  Is it inside of an `extern "C" {}' block?  If so, it shouldn't be.
>> 
>> -Dave
>> 
>> On Jan 24, 2011, at 10:10 PM CST, Norman Lo wrote:
>> 
>>> Hi all,
>>> 
>>> I am trying to compile a program called A++P++ with mpich2-1.3.1. I am getting an error about conflicting C functions and below is the detailed message. Could anyone help me on this ? Thank you very much with any help.
>>> 
>>> Norman
>>> 
>>> mpicxx -DHAVE_CONFIG_H -I. -I. -I../.. -I. -I. -I../.. -I../../include -I/hivehomes/normanlo/MPI2-1.3/include -I../../PARTI -I../../PARTI -I/hivehomes/normanlo/MPI2-1.3/include -O -Wstrict-prototypes -fPIC -c -o MPI_specific.o `test -f MPI_specific.C || echo './'`MPI_specific.C
>>> cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
>>> /hivehomes/normanlo/MPI2-1.3/include/mpicxx.h:2699: error: declaration of C function ‘void MPI::Init(int&, char**&)’ conflicts with
>>> /hivehomes/normanlo/MPI2-1.3/include/mpicxx.h:2698: error: previous declaration ‘void MPI::Init()’ here
>>> /hivehomes/normanlo/MPI2-1.3/include/mpicxx.h:2701: error: declaration of C function ‘int MPI::Init_thread(int&, char**&, int)’ conflicts with
>>> /hivehomes/normanlo/MPI2-1.3/include/mpicxx.h:2700: error: previous declaration ‘int MPI::Init_thread(int)’ here
>>> gmake[3]: *** [MPI_specific.o] Error 1
>>> 
>>> _______________________________________________
>>> mpich-discuss mailing list
>>> mpich-discuss at mcs.anl.gov
>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> _______________________________________________
>> mpich-discuss mailing list
>> mpich-discuss at mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> 
> _______________________________________________
> 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