我编写了一个 C++ 程序(mainPixelDet1.C
,它使用在 PixelDet1.C
中定义的类),它在 root 的交互模式下工作。
但现在我想使用 g++ 在 root 之外编译它。
这是我在终端上写的:
g++ -o main mainPixelDet1.C PixelDet1.C `root-config --cflags --glibs`
这是我得到的:
/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
最佳答案
您还必须将 --ldflags
包含到 root-config
中,以便 root-config
将提供必要的库标志参数。
关于c++ - 如何使用 g++ 编译带有根库的 C++ 程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27207722/