c - Mac OS X 塞拉利昂 : Undefined symbols for architecture x86_64

标签 c xcode macos clang linphone-sdk

我试图在 Mac OS X Sierra 中基于 Linphone 构建一个 C 源文件,但出现以下错误。

这是 C 源文件的链接。 http://www.linphone.org/docs/liblinphone/group__basic__call__tutorials.html

编辑:

我正在尝试用这个命令编译源代码

clang -o tt tt.c -I/Users/softdev/Downloads/linphone-sdk-3.11.1-mac/include/

错误:

Undefined symbols for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经尝试更改 objective-c pu 但没有成功。

我的系统有 XCode 8。如有任何帮助,我们将不胜感激。

已编辑:完成输出

Undefined symbols for architecture x86_64:
  "_linphone_call_get_state", referenced from:
      _main in tt-ca2045.o
  "_linphone_call_ref", referenced from:
      _main in tt-ca2045.o
  "_linphone_call_unref", referenced from:
      _main in tt-ca2045.o
  "_linphone_core_destroy", referenced from:
      _main in tt-ca2045.o
  "_linphone_core_invite", referenced from:
      _main in tt-ca2045.o
  "_linphone_core_iterate", referenced from:
      _main in tt-ca2045.o
  "_linphone_core_new", referenced from:
      _main in tt-ca2045.o
  "_linphone_core_terminate_call", referenced from:
      _main in tt-ca2045.o
  "_ms_usleep", referenced from:
      _main in tt-ca2045.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

最佳答案

我得到了使用这个编译的示例代码:

clang -o hello hello.c -Ilinphone-sdk-3/include -Llinphone-sdk-3/lib -llinphone -lmediastreamer_base

Clang 的 -I 参数指向 header (.h) 文件所在的位置

至于我的补充,-L 指定了 clang 到达 lib 文件所在位置的路径。在您的情况下,它可能位于 -L/Users/softdev/Downloads/linphone-sdk-3.11.1-mac/lib

然后 -l 指定要包含哪些动态库(去掉 lib 前缀和 dylib 后缀)。

最后,您需要在您指向的示例代码中添加一个缺失的行。添加:

#include <unistd.h>

signal.h之后

关于c - Mac OS X 塞拉利昂 : Undefined symbols for architecture x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43070123/

相关文章:

Photo Framework 将 iOS 状态栏变黑

iphone - 如何在 Xcode 4 中重置“仅最近使用的文件”过滤器?

objective-c - Xcode SQLite-没有这样的表

macos - 核心数据软管本身

c - 没有阻塞线程

c - C 中的 MemAlloc 是什么?它与 malloc 有何不同?

c++ - 将链接器标志添加到 configure.ac

.net - 如何将空目录复制到 Visual Studio 中的输出?

macOS:无法将 NSTextField 置于基于自定义 NSView 的类中

cocoa - 以编程方式将 mp3 解码为 wav 的简单方法?