0

I am trying to compile this package and keep getting an undefined reference to error. I copied and edited the final compiler code in the makefile to make sure the external libraries needed are called before the other libraries.

Here's the error,

<path>/libqroot.so: undefined reference to `TLatex::TLatex()'

TLatex.h is in <path>/ROOT/include , TLatex is defined in the library Graf(libGraf.so) and is in <path>/ROOT/lib

Here's the command,

g++ file.cxx -Wall -g  -ggdb -fPIC -pthread -m64
-I<root-path>/ROOT/include 
-I/usr/include 
-I./ 
-I/usr/include 
-I<root-path>/ROOT/include 
-I<project-path>/pkg/base/ 
-I<project-path>/pkg/dianaglobal/ 
-I<project-path>/pkg/globalrw/ 
-I<project-path>/pkg//coretools/ 
-L<project-path>/lib 
-L<root-path>/ROOT/lib 
-lqroot -lcoretools -lmathtools -lbase -lgsl -lgslcblas-lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -lGeom -lMinuit -lSpectrum -lMathMore -lMathCore -lThread -lRootAuth -lFoam
-o <project-path>/bin//file

Obviously there are no newline chars.

Please help me figure what's wrong.

Thank you.

0

1 Answer 1

1

First make sure -lGraf is passed in, if the symbol is in libGraf.so. The order of the link line matters. For g++ a library containing the definition of a function should appear after any source files or object files which use it. So given the error you are seeing:

-lqroot -lGraf -lcoretools -lmathtools -lbase -lgsl -lgslcblas

http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options

Further to you edit, this error will occur if your header files do not match your libraries.

Sign up to request clarification or add additional context in comments.

1 Comment

oops, sorry there's a big space between so u probably didn't see it. (Sorry added spaces to distinguish those in the terminal, and removed all but this)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.