Is it possible to build one Petsc that works for both C and C++?

Shi Jin jinzishuai at yahoo.com
Sun Jun 17 10:59:35 CDT 2007


But this is what I got trying to compile my C petsc
code with the C++ build:
In file included from
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpi.h:1104,
                 from spAF_incl.h:20,
                 from spAF_analyt.h:11,
                 from spAF_analyt.c:11:
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpicxx.h:26:2:
error: #error "SEEK_SET is #defined but must not be
for the C++ binding of MPI"
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpicxx.h:30:2:
error: #error "SEEK_CUR is #defined but must not be
for the C++ binding of MPI"
/mnt/200g/works/MyWork/PETSc/C++PETSc/petsc-2.3.3-p3/externalpackages/mpich2-1.0.5p4/linux-gnu-cxx-debug/include/mpicxx.h:35:2:
error: #error "SEEK_END is #defined but must not be
for the C++ binding of MPI"
make: *** [spAF_analyt.o] Error 1

Did you do anything special? I am using GCC.
Thanks.

Shi
--- Matthew Knepley <knepley at gmail.com> wrote:

> On 6/17/07, Shi Jin <jinzishuai at yahoo.com> wrote:
> > Hi,
> >
> > I am learning the unstructured part of Petsc,
> which
> > naturally uses C++(at least the sample I am
> studying
> > is C++). On the other hand, my old Petsc codes are
> all
> > written in C.
> > I found that once I build the Petsc with C++, the
> old
> > C codes cannot be compiled since it is trying to
> use
> > mpicxx to compile the .c source files. However, I
> do
> 
> This should be no problem. I do it all the time. Any
> C++
> compiler can compile C just fine.
> 
>   Matt
> 
> > see after the configuration stage that there is a
> > list:
> > C compiler: mpicc
> > C++ compiler: mpicxx
> > Fortran compiler: mpif77
> >
> > Is it possible to instruct Petsc to use the
> > corresponding  compiler for different source
> codes?
> > Thanks a lot.
> > PS. This is how I configured my Petsc-2.3.3-p3:
> > ./config/configure.py --with-cc=gcc --with-fc=g77
> > --with-cxx=g++ --download-f-blas-lapack=1
> > --download-mpich=1 --with-clanguage=cxx
> --with-sieve=1
> > --download-boost=1 --download-chaco
> > --download-parmetis   --download-fiat 
> --download-generator
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Get the Yahoo! toolbar and be alerted to new email
> wherever you're surfing.
> >
>
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
> >
> >
> 
> 
> -- 
> What most experimenters take for granted before they
> begin their
> experiments is infinitely more interesting than any
> results to which
> their experiments lead.
> -- Norbert Wiener
> 
> 



      ___________________________________________________________________________________
You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html




More information about the petsc-users mailing list