Hi all!
Using TreeName->MakeSelector(“selectorname”) and trying to use this selector in some code that I’d like to compile via g++ I encounter a strange problem, with following error message:
This happens when linking, but only when I’m doing the linking using intermediate *.o files.
You can easily reproduce this behaviour:
[ol]
[li] create a selector from a root tree that’s available to you, name it “selector” (load the root file, then do a TreeName->MakeSelector("selector")
edit the “selector.h” and add the following include lines:
#include <vector>
#include <string>
using std::string;
using std::vector;
[/li]
[li] create a file “main.C” with following content
[code]
#include <TChain.h>
#include “selector.h”
int main( int argc, char* argv ) {
TChain* chain = new TChain(“YOURROOTFILE.root”);
selector* myselector = (selector*) TSelector::GetSelector(“selector.C+”);
chain->Process(“selector.C+”);
}
[/code][/li]
[li] produce the object code
> g++ $(root-config --cflags --libs) main.C selector.C -c
and link these files
> g++ $(root-config --cflags --libs) *.o
The strange this is, when compiling and linking with
> g++ $(root-config --cflags --libs) main.C selector.C
Anybody knows help?
I also searched the forum and all I could find was this thread, but I couldn’t really figure out, how it could help in my case:
[url]Undefined symbol when using macro code in Selector
I would appreciate any kind of help!