Issue Regarding Header files and Directories

usr/bin/ld: CMakeFiles/sim.dir/Sim.cc.o: in function MyActionInitialization::Build() const': Sim.cc:(.text+0x3333): undefined reference to MyEventAction::MyEventAction(MyRunAction*)’
/usr/bin/ld: Sim.cc:(.text+0x3366): undefined reference to `MySteppingAction::MySteppingAction(MyEventAction*)’
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sim.dir/build.make:147: sim] Error 1
make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/sim.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

How can I solve this
Please Help.

This probably means you haven’t provided a definition/implementation for MyEventAction::MyEventAction(MyRunAction*) (and similarly for MySteppingAction::MySteppingAction(MyEventAction*). I.e. you’ve probably only got something like

class MyEventAction ...
{
  public:
   MyEventAction(MyRunAction*); // this is the definition
...
};

and you also need the definition, i.e. the actual body of that function. E.g. in MyEventAction.cc:

MyEventAction::MyEventAction(MyRunAction*)
{
  // code to construct MyEventAction goes here
}
1 Like

Okay, I will try and rectify that. Thank You.

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