【发布时间】:2016-08-26 03:40:22
【问题描述】:
我想在我的 Xcode IDE 中从 CERN 设置 ROOT,但在链接库时遇到问题。我正在使用 root 6.04.14 和 xcode 7.3。 我创建了一个模拟项目,其中只有一个 .cpp,其中包含一个来自根目录的基本类(#include "TFile.h")。我可以通过以下方式从命令行编译:
clang++ -std=c++11 -I/opt/root/root-6.04.14/include/root -L/opt/root/root-6.04.14/lib/root -lCore main.cpp
现在开始在 Xcode IDE 中设置所有内容。我在头文件搜索路径中包含了“/opt/root/root-6.04.14/include/root”,Xcode 没有抱怨,所以我猜它找到了头文件。我尝试将“/opt/root/root-6.04.14/lib/root -lCore”添加到库搜索路径,但出现错误: 在 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:301 包含的文件中: /opt/root/root-6.04.14/include/root/Math/math.h:65:11:错误:全局命名空间中没有名为“log1p”的成员;你的意思是简单的'log1p'吗? 返回 ::log1p(x); ^~ /opt/root/root-6.04.14/include/root/Math/math.h:63:15:注意:此处声明的“log1p” 内联双 log1p(双 x){ ^ /opt/root/root-6.04.14/include/root/Math/math.h:76:11:错误:全局命名空间中没有名为“expm1”的成员;你的意思是简单的'expm1'吗? 返回 ::expm1(x); ^~ /opt/root/root-6.04.14/include/root/Math/math.h:74:15:注意:此处声明的“expm1” 内联双 expm1( 双 x) {
等等…… 此外,当我查看 Xcode 正在运行的终端命令时(至少我认为它是这样做的),没有包含“-L/opt/root/root-6.04.14/lib/root -lCore”。然后我尝试将“-L/opt/root/root-6.04.14/lib/root -lCore”放入其他链接器标志。现在它包含在终端命令中,但仍然给我同样的错误。
问题1: 我注意到 Xcode 正在运行“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang”,而我一直在使用 clang++,区别在哪里,我该如何更改? 问题2: 将目录添加到库搜索路径并通过链接器标志将其放入有什么区别? 问题3: 大佬,我哪里搞砸了?
【问题讨论】:
标签: c++ xcode root-framework