Hello,
I’m finding this error when using my class which is derived from TOBject. Below the description of the class:
In myClass.h:
#ifdef CINT
#pragma link C++ class vector+;
#endif
class myClass : public TObject {
public:
myClass(){};
myClass(const vector& UserData);
ClassDef(myClass, 1)
};
in myClass.cxx I have:
#include “myClass.h"
ClassImp(myClass)
myClass:myClass(const vector& UserData){
…
}
I create the dictionaries, compile all (myClass.cxx is compiled and added in a so library) and then try to use the library, but when linking I have this error:
Undefined symbols for architecture x86_64:
“myClass::myClass(std::vector<double, std::allocator > const&)", referenced from:
EventSelection::isThereATrueParticle(float, float, float, float, float, float, float, float, float&, float&, float&) in EventSelection.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
This does happen to any method that used std::vector, not to others.
This does happen only if the implementation of the method (in this case the constructor) is in the .cxx file. If the same code is implemented in myClass.h then the error disappears.
I tried to add the #pragma command in the header file, but this does not cure. I also tried to add the #pragma command in LinkDef.h file and add it in the cint command, but it says :
Note: Link requested for already precompiled class vector<double,allocator > (ignore this message) :0:
So I think the dictionary is ready to use vectors, but do not link it correctly.
Can you suggest how to implement it?
Cheers,
francesca