<br><div class="gmail_quote">On Wed, May 19, 2010 at 8:56 PM, Satish Balay <span dir="ltr">&lt;<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I don&#39;t understand the code change - but if you want to use c99<br>
complex - you can build petsc with:<br>
<br>
--with-scalar-type=complex --with-clanguage=c [which is the default for clanguage]<br>
<br>
And no code-change needed for PETSc. However if your code uses c++ -<br>
you might have to address that..<br></blockquote><div>Badly, my code uses C++.  I compiled PETSc with  &quot;--with-scalar-type=complex --with-clanguage=c&quot; and I<br>added <br>include ${PETSC_DIR}/conf/variables<br>include ${PETSC_DIR}/conf/rules<br>
in my makefile. So, could it possible to specify g++ for my code and to link c-version petsc?<br><br>kind regards,<br>Zhengyong <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<font color="#888888"><br>
Satish<br>
</font><div><div></div><div class="h5"><br>
On Wed, 19 May 2010, RenZhengYong wrote:<br>
<br>
&gt; Hi,  PETSc team,<br>
&gt; I wrote a C++ code dealing with electromagnetic problems, which can smoothly<br>
&gt; call PETSc complied by using &quot; --with-scalar-type=complex<br>
&gt; --with-clanguage=cxx&quot; .<br>
&gt; To improve the performances of the C++ code, I changed the complex number of<br>
&gt; type from std::complex&lt;double&gt; to double _Complex (C99 standard, roughly<br>
&gt; 30~50 times faster compared to std::complex&lt;double&gt;). But when I find that<br>
&gt; the C99 complex number head file &lt;complex.h&gt; will lead to the following<br>
&gt; kinds of errors&quot;<br>
&gt;<br>
&gt; /usr/include/c++/4.3/complex:57: error: expected identifier before<br>
&gt; ‘__complex__’<br>
&gt; /usr/include/c++/4.3/complex:58: error: expected identifier before<br>
&gt; ‘__complex__’<br>
&gt; /usr/include/c++/4.3/complex:58: error: expected unqualified-id before ‘&lt;’<br>
&gt; token<br>
&gt; /usr/include/c++/4.3/complex:59: error: expected identifier before<br>
&gt; ‘__complex__’<br>
&gt; /usr/include/c++/4.3/complex:59: error: expected unqualified-id before ‘&lt;’<br>
&gt; token<br>
&gt; /usr/include/c++/4.3/complex:60: error: expected identifier before<br>
&gt; ‘__complex__’<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:157: error:<br>
&gt; expected unqualified-id before ‘__complex__’<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:306: error:<br>
&gt; ‘PetscScalar’ does not name a type<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:339: error:<br>
&gt; ‘PetscScalar’ does not name a type<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: warning:<br>
&gt; ‘PetscGlobalSum’ initialized and declared ‘extern’<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
&gt; ‘PetscScalar’ was not declared in this scope<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
&gt; expected primary-expression before ‘,’ token<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
&gt; ‘PetscScalar’ was not declared in this scope<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
&gt; expected primary-expression before ‘,’ token<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
&gt; expected primary-expression before ‘)’ token<br>
&gt; /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
&gt; initializer expression list treated as compound expression<br>
&gt;<br>
&gt;<br>
&gt; Could you please give me some idea to deal with these problems?<br>
&gt;<br>
&gt; Kind regards,<br>
&gt; Zhengyong Ren<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Zhengyong Ren<br>AUG Group, Institute of Geophysics<br>Department of Geosciences, ETH Zurich<br>NO H 47 Sonneggstrasse 5<br>CH-8092, Zürich, Switzerland<br>Tel: +41 44 633 37561<br>
e-mail: <a href="mailto:zhengyong.ren@aug.ig.erdw.ethz.ch">zhengyong.ren@aug.ig.erdw.ethz.ch</a><br>Gmail: <a href="mailto:renzhengyong@gmail.com">renzhengyong@gmail.com</a><br>