Including G4VHit.hh causes huge amount of errors when making

Geant4 Version: 11.2.2
Operating System: Linux


I’m trying to set up a simulation that records hits and the only error I have is whenever I include G4VHit.hh, which causes hundreds of errors to appear in files outside what I’ve edited.

Here are some of these errors that I’m getting.

/usr/include/c++/13/bits/stl_list.h: At global scope:
/usr/include/c++/13/bits/stl_list.h:631:49: error: ‘allocator’ in namespace ‘B4::std’ does not name a template type; did you mean ‘uses_allocator’?
  631 |   template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
      |                                                 ^~~~~~~~~
      |                                                 uses_allocator
/usr/include/c++/13/bits/stl_list.h:631:58: error: expected ‘>’ before ‘<’ token
  631 |   template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
      |                                                          ^
/usr/include/c++/13/bits/stl_list.h:644:21: error: ‘is_same’ was not declared in this scope; did you mean ‘std::is_same’?
  644 |       static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
      |                     ^~~~~~~
      |                     std::is_same
/usr/include/c++/13/type_traits:709:12: note: ‘std::is_same’ declared here
  709 |     struct is_same;
      |            ^~~~~~~
/usr/include/c++/13/bits/stl_list.h:644:38: error: expected nested-name-specifier before ‘remove_cv’
  644 |       static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
      |                                      ^~~~~~~~~

Is there a way to get around this or am I able to not include G4VHit.hh and still have my code work?

I’m not sure why the inclusion of G4VHit.hh would trigger this, but it looks like you might have #included something inside a namespace B4 {} scope. That’s the only reason I can think of why the namespace 'B4::std' message appears.