Issue making executable in example

Hello, I am trying to compile an example using the Geant4 10.02.p03 on my university cluster. When linking the CXX executable, I get the following error:

[100%] Linking CXX executable exampleB1
CMakeFiles/exampleB1.dir/src/B1PrimaryGeneratorAction.cc.o:B1PrimaryGeneratorAction.cc:function B1PrimaryGeneratorAction::GeneratePrimaries(G4Event*): error: undefined reference to 'G4Exception(char const*, char const*, G4ExceptionSeverity, std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&)'
collect2: error: ld returned 1 exit status
make[2]: *** [exampleB1] Error 1
make[1]: *** [CMakeFiles/exampleB1.dir/all] Error 2
make: *** [all] Error 2

With other examples, the issue is always with an undefined reference to G4Exception. The error is similar to a previous topic, but I am using GCC version 9.2.0 and CMake version 3.16.5, so I know it is not the same issue as this topic. Geant4 examples compile without error on version 10.07.p02, which is also available on my university cluster. I’m not sure if it has to do with the header file for G4Exception existing in version 10.07 but not 10.02. Is there a way around this error?