繁体   English   中英

如何使用根库编译C ++程序包括使用g ++?

[英]How can I compile a C++ program with root library includes using g++?

我写了一个C ++程序( mainPixelDet1.C使用中定义的类PixelDet1.C ),在根的交互式模式下工作。

但现在我想使用g ++在root之外编译它。

这是我在终端上写的内容:

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

而这就是我得到的:

/ usr / bin / ld:找不到-lGraf3d
usr / bin / ld:找不到-lPostscript
/ usr / bin / ld:找不到-lPhysics
collect2:错误:ld返回1退出状态

您还必须将--ldflags包含在root-config ,以便root-config将提供必要的库标志参数。

我遇到了同样的问题,我刚刚解决了安装这些库的问题: "libroot-*""root-plugin-*""ttf-root-installer"如果您有兴趣,我会在ROOT论坛上找到答案,这里是链接: https//root.cern.ch/phpBB3/viewtopic.php?t = 16352 要安装库,可以在终端上编写以下命令行:

sudo apt-get install nameoflibrary

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM