I try to invoke root class in Qt project, but most of them failed.
by add some cmd in the .pro file
INCLUDEPATH += \
/usr/local/opt/root6/include
LIBS += \
-L/usr/local/opt/root6/lib
QMAKE_PRE_LINK += /usr/local/opt/root6/bin/root-config --cflags --libs
and source code
#include "TMath.h"
...
ui->label->setText(QString::number(TMath::Pi()+Int_t(32),10,10));
successfully, it works. But, that’s all. When I try to include other class, TString ,for example, it breakdown.
symbol(s) not found for architecture x86_64
linker command failded with exit code 1(use -v to see invocation)
Have you ever met this case? Thank you~
some codes attached below.
QtRoot.zip
linev
March 20, 2019, 8:57am
2
I don’t think it works as you intend to.
Most probably, root-config will be called before linking but no qmake variables will be changed.
You should add list of used ROOT libraries to LIBS
1 Like
Great! It works, Thanks so much!
follow your suggestion, I delete QMAKE_PRE_LINK
code, and append the lib.
LIBS += \
-L/usr/local/opt/root6/lib -lCore -lImt -lRIO -lNet -lHist -lGraf \
-lGraf3d -lGpad -lTree -lTreePlayer -lRint -lPostscript -lMatrix \
-lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic
Now, TFile, TString, TTree work well. Previously,I have try similar ways, but failed, maybe arising from improper settings. Anyway, thanks again!
system
Closed
April 3, 2019, 9:42am
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.