c++ - OSX 磁盘仲裁链接器错误

标签 c++ macos linker-errors

尝试使用 clang 编译我的 C++ 应用程序,该应用程序有效,但出现以下链接器错误:

Undefined symbols for architecture x86_64:
"_DADiskCopyDescription", referenced from:
  Security::getHddID() in Security.cpp.o
"_DADiskCreateFromBSDName", referenced from:
  Security::getHddID() in Security.cpp.o
"_DASessionCreate", referenced from:
  Security::getHddID() in Security.cpp.o
ld: symbol(s) not found for architecture x86_64

我已经在 Apple 网站上查看了磁盘仲裁的官方文档,但这很糟糕,因为它甚至没有告诉您要包​​含哪个库文件,更不用说链接到什么了。

我正在使用 CMake 来设置我的构建链。

最佳答案

您需要在链接器参数中使用-framework DiskArbitration

关于c++ - OSX 磁盘仲裁链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29158243/

相关文章:

c++ - 如何删除具有指针成员的类的指针?

c++ - Visual C++ 2015 中的 CSpice : Link errors

c++ - 将函数 erf() 和 erfc() 添加到 math.h _ C 的基础知识。

c++ - Qt WheelEvent,如果按下滚轮如何获取?

c++ - 编辑项目时 QAbstractItemView 选项卡焦点

c++ - 如何修复 C++ 内存泄漏?

objective-c - 从基本 C、xcode 项目调用 Objective-C 类

我们可以像在 Windows 上一样直接用 C 在 OS X 和 Linux 上制作图形吗?

ruby - 在 mac 上安装、运行 FaSTLane for Flutter 时出错

c++ - 未定义对 `typeinfo for class' 的引用