[MPICH] about C++ and SEEK_SET

Zaiwen zw2109 at columbia.edu
Mon Nov 21 10:24:06 CST 2005



Hi, I encountered a problem during making package "Trilinos" with mpi. The error information was:

SEEK_SET is #defined but must not be for the C++ binding of MPI


The following is the solution from mpich2 FAQ:
------------------------------------------------
C++ and SEEK_SET
Some users may get error messages such as 
    SEEK_SET is #defined but must not be for the C++ binding of MPI

The problem is that both stdio.h and the MPI C++ interface use SEEK_SET, SEEK_CUR, and SEEK_END. This is really a bug in the MPI-2 standard. You can try adding 
    #undef SEEK_SET
    #undef SEEK_END
    #undef SEEK_CUR

before mpi.h is included, or add the definition 
    -DMPICH_IGNORE_CXX_SEEK

to the command line (this will cause the MPI versions of SEEK_SET etc. to be skipped). 
------------------------------------------------


I've tried the first solution -- modify every include file and c++ source file which errors occured. However, I can't get through compiling a file "ml_agg_min_energy.cpp". It required definitions of "SEEK_SET, SEEK_END, SEEK_CUR" for "stdio.h". I can not figure out which ".h" file introduced such confliction although I change the order of declaration of "stdio.h" and "mpi.h" in some files.


My questions is :
	1.  Is there any simple solution rather modifing file by file?

	2.  How to figure out the second solution, say, how to add the definition  "  -DMPICH_IGNORE_CXX_SEEK" to the command line ? The meaning is vague here.   Is this solution simpler than the first solution? 


Thank you so much!


With my Best!
Zaiwen







More information about the mpich-discuss mailing list