【问题标题】:Linking to ROOT files in xCode在 xCode 中链接到 ROOT 文件
【发布时间】:2013-06-07 17:02:24
【问题描述】:

我需要链接到 xcode 3.2.6 项目中 /root/lib 和 /root/include 中的 .so 文件和头文件。 ROOT 是 CERN 的一个分析框架。

有一个实用程序 root-config,它将返回所有必需的库,我可以使用以下命令在命令行上编译:

CFLAGS = `root-config --cflags`
GLIBS = `root-config --glibs`

test : main.cpp main.h
    g++ $(CFLAGS) $(GLIBS) -g -Wall main.cpp -02 -o test 

程序运行良好,没有错误。但是,我想在整个项目中使用 xcode,但也无法使用

A:使用这个工具

B:搜索 .so 文件的正确路径。我在构建设置下的构建变量 header_search_paths 和 library_search_paths 中包含了 /root/lib 和 /root/include 。然后我实际上将我需要的文件输入到 other_linker_flags 中,如下所示: -llibTree -llibHist -llibRIO -llibCint -llibCore

xcode 返回消息:

ld: library not found for -llibTree
collect2: ld returned 1 exit status
Command /Developer/usr/bin/g++-4.2 failed with exit code 1

有人知道发生了什么吗? xCode 可以编译 .so 文件吗?这里还有其他问题吗?

【问题讨论】:

    标签: c++ xcode linker root-framework


    【解决方案1】:

    这与ROOT无关。要链接库搜索路径中名为 libSomething.so 的库,您可以使用链接器标志 -lSomething。你想链接到例如libTree.so,所以要使用的正确标志是-lTree,而不是-llibTree,它会寻找liblibTree

    【讨论】:

    • 我的项目与 libCling.so 链接正常,但抛出 dyld: Library not loaded: @rpath/libCling.so Reason: image not found 任何想法?
    猜你喜欢
    • 2016-08-26
    • 2010-10-22
    • 1970-01-01
    • 2022-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-24
    • 2014-09-06
    相关资源
    最近更新 更多