I have written a C++ program (mainPixelDet1.C
that uses a class defined in PixelDet1.C
), that works in root's interactive mode.
But now I want to compile it outside root, using g++.
Here's what I write on the Terminal:
g++ -o main mainPixelDet1.C PixelDet1.C `root-config --cflags --glibs`
And here's what I get:
/usr/bin/ld: cannot find -lGraf3d
usr/bin/ld: cannot find -lPostscript
/usr/bin/ld: cannot find -lPhysics
collect2: error: ld returned 1 exit status
-L
specifying the directory where those libraries are located. If they are in different directories, you might need more than one-L
– Joe.cpp
extension, for clarity and to tell the compiler easily whether it needs to compile as c++..c
tends to be used for C – foips.C
extension, since it emphasizes where it came from. – Shep