Error in EventAction.cc

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_11.2
_Operating System:_Ubuntu 20.04

Dear friends,

When I want to add the EventAction.hh/.cc in the examples of dnaphysics to complete the total energy deposit like B1. I meet the error at follows when I try to make it.

Scanning dependencies of target dnaphysics
[ 9%] Building CXX object CMakeFiles/dnaphysics.dir/src/SteppingAction.cc.o
[ 18%] Linking CXX executable dnaphysics
/usr/bin/ld: CMakeFiles/dnaphysics.dir/src/EventAction.cc.o: in function EventAction::EndOfEventAction(G4Event const*)': EventAction.cc:(.text+0x9b): undefined reference to RunAction::AddEdep(double)’
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/dnaphysics.dir/build.make:264:dnaphysics] Error 1
make[1]: *** [CMakeFiles/Makefile2:76:CMakeFiles/dnaphysics.dir/all] Error 2
make: *** [Makefile:130:all] Error 2

I guess this may be an error in my CMakeLists.txt file, but I dont know how to modify it.

CMakeLists.txt (2.0 KB)


The compilation error says that you do not provide the implementation of RunAction::AddEdep(double)’. You should check your RunAction.hhand RunAction.cc` files

Best regards,

Thank you very much. I find I do not write the function of AddEdep() in RunAction.cc.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.