gpt4 book ai didi

c++ - 如何使用 g++ 编译带有根库的 C++ 程序?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:02:04 25 4
gpt4 key购买 nike

我编写了一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com