I am attempting to make a histogram program work, but I believe I am missing something extremely basic. In the following code, the bins are incremented corrrectly (I hope. When I but in other code to incrmement other variables, they are incremented correctly), but when I run the program, no histogram pops up. I compiled the program as a separate binary using “g++ -o histo -O0 -I./include -L./lib -lHist -lCore -lMatrix -lCint ./histo.cpp” on Mac OS X 10.4.1 using ROOT 4.04/02 and X11 4.4.0. Would it be easier to get this to run directly in ROOT? I tried many things, but couldn’t get the code to execute properly, possibly because of the external headers it uses, and also because I couldnt figure out how to get it to accept command line inputs (the file to be analyzed). Preferably though, I’d like to get the standalone binary working.
using namespace std;
int main(int argc, char *argv[]){
TH1F *hfix = new TH1F(“hfix”,“hfix title”,52,0,2080);
qneteventlist mylist(argc,argv);
while(!mylist.End()){
int bad = mylist.GetNextEvent();
if(!bad & (mylist.CurrentEvent.fall[0]-mylist.CurrentEvent.rise[0]) > 0){
int diff=(mylist.CurrentEvent.fall[0]-mylist.CurrentEvent.rise[0]);
hfix->Fill(diff);
}
}
After adding a header file and the TApplication object almost exactly as in the example, everything compiles fine. However, upon running, I get the following error:
[size=84]dlopen error: dlopen(/Users/captbob/Desktop/root/lib/libGX11TTF.so, 9): Symbol not found: __ZN3TTF11fgRotMatrixE
Referenced from: /Users/captbob/Desktop/root/lib/libGX11TTF.so
Expected in: dynamic lookup
Load Error: Failed to load Dynamic link library /Users/captbob/Desktop/root/lib/libGX11TTF.so[/size]
The library is there and I know of no reason why it should not be working. Anyone know what is going on?
Your PATH variable does not include the ROOT libraries
or you forgot to link with the ROOT libraries. To see the list
of recommended libs when linking a graphics application run
root-config --glibs
I appended all of the libraries in there to the one I already had for [size=84]“g++ -o histo -O3 -I./include -L./lib -lHist -lCore -lMatrix -lCint -lGX11TTF -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lfreetype -lGui -lpthread -lm -ldl ./histo.cpp”[/size]
I then still got an error message ( a little diffferent):
[size=84]
dyld: Symbol not found: __ZThn68_N5TGX1113SetMarkerSizeEf
Referenced from: /Users/captbob/Desktop/root/lib/libGX11TTF.dylib
Expected in: dynamic lookup
Trace/BPT trap
[/size]
My DYLD_LIBRARY_PATH and other variables are all set correctly. Perhaps I am missing another library? It compiled and linked fine however.