Undefined reference c++ issue in latest version

Ubuntu 22.04
GCC 11.4.0
cmake version 3.29.0

Hello everyone I was copying this youtube tutorial(https://youtu.be/hF3KBjLLIiM?si=iP0cADRuEYvxY3pl) for geant4 but I keep running into this error

lakshya@lakshya-G5-5505:~/sim/build$ make[ 50%] 
Linking CXX executable sim/usr/bin/ld: CMakeFiles/sim.dir/sim.cc.o: in function `main':sim.cc:(.text+0x75): undefined reference to `MyDetectorConstruction::MyDetectorConstruction()'/usr/bin/ld: sim.cc:(.text+0xab): undefined reference to `MyPhysicsList::MyPhysicsList()'collect2: 
error: ld returned 1 exit statusmake[2]: *** [CMakeFiles/sim.dir/build.make:136: sim] Error 1make[1]: *** 
[CMakeFiles/Makefile2:84: CMakeFiles/sim.dir/all] Error 2make: *** [Makefile:91: all] Error 2

Cmake is able to run perfectly but when I try to run the make files I get these error. Other people who tried to run the code mentioned in the youtube video also got the same error. If anybody can help me know if this is a version issue or something else it would be of great help…