我需要链接到xso 3.2.6中的项目中的/ root / lib和/ root / include中的.so文件和 header 。 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,但无法将其用于任何一个

答:使用此实用程序

要么

B:搜索.so文件的正确路径。我在构 build 置下的构建变量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文件吗?这里还有其他问题吗?

最佳答案

这与根无关。要在库搜索路径中链接到名为libSomething.so的库,可以使用链接器标记-lSomething。您想链接到例如libTree.so,因此要使用的正确标志将是-lTree,而不是将寻找-llibTreeliblibTree

10-07 19:01
查看更多