[petsc-users] Compile error on petsc-3.17

Satish Balay balay at mcs.anl.gov
Thu Dec 1 09:22:08 CST 2022


Do you get these errors when you compile petsc/slepc examples - with corresponding makefiles?

Likely the issue is the difference in g++ compiler options [between these example builds - and your build]

Satish

On Thu, 1 Dec 2022, Jake Lee 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);}
>       |
>                                                                       ^~~~
> 
> 
> 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 (이재규)
> 


More information about the petsc-users mailing list