How can I compile a C ++ program with a library root including g ++?

I wrote a C ++ program ( mainPixelDet1.C

that uses the class defined in PixelDet1.C

) that runs in root interactive mode.

But now I want to compile it outside of root using g ++.

This is what I write in Terminal:

g++ -o main mainPixelDet1.C PixelDet1.C `root-config --cflags --glibs`

      

And this is what I get:

/ usr / bin / ld: cannot find -lGraf3d
usr / bin / ld: cannot find -lPostscript
/ usr / bin / ld: cannot find -l
Physics collect2: error: ld returned 1 exit status

+3


source to share


2 answers


You must also include --ldflags

in root-config

to root-config

provide the required library flag arguments.



+2


source


I had the same problem, and I just decided to install these libraries: "libroot-*"

, "root-plugin-*"

, "ttf-root-installer"

.` I find the answer to ROOT forum, if you're interested, here's the link: https://root.cern.ch/phpBB3/viewtopic.php?t = 16352 . To install the library, you can write the following command line in the terminal:



sudo apt-get install nameoflibrary

      

+1


source







All Articles