【发布时间】:2015-10-22 12:26:20
【问题描述】:
在使用 cmake 构建项目(使用 GStreamer 1.0,因此依赖于 Glib 2.0)并链接到 glib 库时,我收到一个奇怪的链接器错误。 Glib 是使用 macports 安装的,libglib-2.0.0.dylib 存在于 /opt/local/lib/ 中。 FindGLIB 成功找到了它的头文件(编译工作),并且 ${GLIB_LIBRARIES} 提供了正确的库路径。
错误信息是
[100%] Linking CXX executable ../bin/presenter
Undefined symbols for architecture x86_64:
"_g_object_set", referenced from:
...
"_g_type_check_instance_cast", referenced from:
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
如果我从列表中完全删除 glib,它也会抱怨缺少对 g_print 和 g_printerr 的引用。是否有可能链接已正确完成,但由于某种原因库中的函数丢失了?
我该如何解决?
【问题讨论】: