[petsc-users] Problem compiling with g++. Uses gcc instead of g++

Christophe Ortiz christophe.ortiz at ciemat.es
Thu Dec 5 10:19:34 CST 2013


Hi all,

Since I would like to use classes, I am moving my C code to C++. I compiled
PETSc with g++ using the following options for the configure:

--with-mpi=0 --with-fc=ifort --with-cxx=g++ --with-debugging=1
--with-scalar-type=real --with-precision=double --download-f-blas-lapack

It did not complain, everything went smooth.

Then to compile I use:

diffusion_c: diffusion.o chkopts
        -${CLINKER} -o diffusion_c diffusion.o ${PETSC_TS_LIB}
        ${RM} diffusion.o


I declared a simple class at the beginning of the file and it complains.
When I compile I get:

gcc -o diffusion.o -c -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing
-Wno-unknown-pragmas -g3 -fno-inline -O0
-I/home/u5751/petsc-3.4.1/include
-I/home/u5751/petsc-3.4.1/ifort-gpp-nompi-double-blas-debug/include
-I/home/u5751/petsc-3.4.1/include/mpiuni
 -D__INSDIR__=src/ts/examples/tutorials/ diffusion.c

diffusion.c:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘defect’
....
....

Obviously, it is because it uses gcc instead of g++ to compile, so it does
not recognize class.
Is it correct to use CLINKER ? Is there another one for g++ ?
Did I miss something ?

Many thanks in advance for your help !
Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131205/8afa73aa/attachment.html>


More information about the petsc-users mailing list