Dylan8024
V2EX  ›  Xcode

Xcode 编译 C 语言的时候缺少库函数该如何添加路径呢?

  •  
  •   Dylan8024 · Oct 29, 2015 · 6370 views
    This topic created in 4044 days ago, the information mentioned may be changed or developed.

    问题是这样的,我下载了 igraph 和 mpi 的包,但是我用 Xcode 去编译的时候还是会出现 igraph.h not found 的情况。
    然后尝试去添加路径但是并不知道在 Bulid Settings 里面的哪里添加。
    希望能够有大神帮忙解决一下这个问题,能编译就好!

    9 replies  •  2015-10-30 10:44:43 +08:00
    hyq
    hyq
    Oct 29, 2015❤️1
    1
    User Header Search Paths
    .so 和.a 文件可以在 Build Phases 的 Link Binary With Libraries 里面添加
    sagnitude
    sagnitude
    Oct 29, 2015❤️1
    2
    如果是引号导入的,把.h 文件拖进项目就行
    如果是尖括号导入, Build Settings ,左上角打开 All ,右上角输入"Header Search Paths"
    Dylan8024
    Dylan8024
    OP
    Oct 30, 2015
    3
    @sagnitude 我先开始就是那样添加的,比如我的 igraph.h 这个文件在 /usr/local/opt/igraph/include/igraph 里面,我就在 Debug 那里面直接输入这个 /usr/local/opt/igraph/include/igraph/igraph.h 吗?
    Dylan8024
    Dylan8024
    OP
    Oct 30, 2015
    4
    @hyq 貌似 Link Binary With Libraries 里面只有 Drag to reorder frameworks 的,木有找到如何添加.so 和.a 的
    MCVector
    MCVector
    Oct 30, 2015
    5
    -I<INCLUDE_DIRECTORY>
    sagnitude
    sagnitude
    Oct 30, 2015
    6
    @Dylan8024 这一栏填的是 Path ,文件夹,不是文件路径,填 “/usr/local/opt/igraph/include/igraph ”
    你把.a 文件直接拖进 X
    code 就可以了,另外 Link Binary With Libraries 左下角有个加号
    Dylan8024
    Dylan8024
    OP
    Oct 30, 2015
    7
    @MCVector 这个是加路径之前的嘛请问
    MCVector
    MCVector
    Oct 30, 2015
    8
    @Dylan8024 在 termnial 里面编译的话把这个加到 CFLAGS 里面就能知道到哪里去找 headers 了。因为没有怎么用 xcode 所以也不太清楚在 xcode 里面怎么设置…
    hyq
    hyq
    Oct 30, 2015
    9
    @Dylan8024 直接拖到这个框里面
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4886 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 02:29 · PVG 10:29 · LAX 18:29 · JFK 21:29
    ♥ Do have faith in what you're doing.