[petsc-users] Compile error on petsc-3.17

Matthew Knepley knepley at gmail.com
Thu Dec 1 09:06:43 CST 2022


On Thu, Dec 1, 2022 at 9:53 AM Jake Lee <leejaku at gmail.com> wrote:

> Dear Petsc Project Manager,
>
> I am Jake Lee with the Advanced Institute of Convergence Technology in
> South Korea.
> I'm programming with Petsc-3.17 and I encountered the following two
> errors.
> PETSC_FUNCTION_NAME_CXX and PETSC_RESTRICT macros are not defined?
>
> 1. ./petsc-3.17.0/include/petscmacros.h:10:31: error:
> ‘PETSC_FUNCTION_NAME_CXX’ was not declared in this scope; did you mean
> ‘PETSC_FUNCTION_NAME_C’?
>    10 | #  define PETSC_FUNCTION_NAME PETSC_FUNCTION_NAME_CXX
>
> 2. In file included from ./slepc-3.17.0/include/slepcsys.h:18,
>                  from ./slepc-3.17.0/include/slepcst.h:16,
>                  from ./slepc-3.17.0/include/slepceps.h:16,
>                  from main.cpp:15:
> ./petsc-3.17.0/include/petscsys.h:2548:108: error: expected ‘,’ or ‘...’
> before ‘*’ token
>  2548 | static inline PetscErrorCode PetscSegBufferGetInts(PetscSegBuffer
> seg,size_t count,PetscInt *PETSC_RESTRICT*slot) {return
> PetscSegBufferGet(seg,count,(void**)slot);}
>       |
>                                          ^
> ./petsc-3.17.0/include/petscsys.h: In function ‘PetscErrorCode
> PetscSegBufferGetInts(PetscSegBuffer, size_t, PetscInt*)’:
> ./petsc-3.17.0/include/petscsys.h:2548:159: error: ‘slot’ was not declared
> in this scope
>  2548 | rrorCode PetscSegBufferGetInts(PetscSegBuffer seg,size_t
> count,PetscInt *PETSC_RESTRICT*slot) {return
> PetscSegBufferGet(seg,count,(void**)slot);}
>       |
>                                                                         ^~~~
>
>
1. PETSC_FUNCTION_NAME_CXX is defined in petscconf.h which is created by
configure. Perhaps you need to rerun your configure
    if you updated from an earlier version. You can check in

       petsc-3.17.0/arch-linux-c-debug/include/petscconf.h

   for the macro

2. The PETSC_RESTRICT is a knock-on error from the last error.

  Thanks,

     Matt


> It seems to be a simple problem. Can I get some hints for them?
>
> My environment is...
> - CentOS 7
> - gcc 9.3.1
> - compile option
> g++ -std=c++17   -I./eigen-3.4.0 -I./boost_1_77_0 -I./petsc-3.17.0/include
> -I./petsc-3.17.0/arch-linux-c-debug/include -I./slepc-3.17.0/include
> -I./slepc-3.17.0/arch-linux-c-debug/include -c main.cpp
>
> Thank you!
>
> Jake Lee (이재규)
>


-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221201/a6618d1f/attachment.html>


More information about the petsc-users mailing list