[petsc-users] compile error of CHKERRQ when linking to PETSC

feng wang snailsoar at hotmail.com
Wed Mar 3 12:14:08 CST 2021


Dear All,

I am new to PETSC and have exercised on a few simple programs to get myself familiar with PETSC and the simple codes work properly. So the environment for PETSC is set up with no problem. Now I am trying to do some work in my big code which is written in C++.  Somehow, I get the compile error for  "CHKERRQ", and the error message is:

~/cfd/petsc/include/petscerror.h:464:196: error: return-statement with a value, in function returning 'void' [-fpermissive]
       do {PetscErrorCode ierr__ = (ierr); if (PetscUnlikely(ierr__)) return PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr__,PETSC_ERROR_REPEAT," ");} while (0)
                                                                                                                                                                           ^
domain/cfd/petsc_nk.cpp:23:7: note: in expansion of macro ‘CHKERRQ’
       CHKERRQ(ierr);

Basically, it complains about "CHKERRQ", if I remove "CHKERRQ", the code compiles with no problem. Could someone please shine some light on this?

Many thanks,
Feng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210303/7851f257/attachment.html>


More information about the petsc-users mailing list