Skip to content

Compilation error "template with C linkage"

I am trying to compile the current (master branch) version of gmsh, but I am experiencing the following compilation error:

/usr/lib/gcc/x86_64-pc-linux-gnu/15.1.1/include/omp.h:448:1: error: template with C linkage                                     
  448 | template<typename __T, omp_allocator_handle_t __Handle>
      | ^~~~~~~~  
/dir/to/gmsh/gmsh/contrib/hxt/tetBR/src/hxt_boundary_recovery.cxx:1:1: note: ‘extern "C"’ linkage started here  
    1 | extern "C" {                                                                
      | ^~~~~~~~~~      

The problematic file hxt_boundary_recovery.cxx contains the block

extern "C" {
#include "hxt_mesh.h"
#include "hxt_tools.h"
#include "hxt_omp.h"
#include "predicates.h"
}

with hxt_omp.h #including <omp.h>, which on my system contains C++ code, which is enabled if __cplusplus is #defined (which it is, by any C++ compiler).