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

Matthew Knepley knepley at gmail.com
Sun Jun 17 09:18:33 CDT 2007


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




More information about the petsc-users mailing list