OSX 磁盘仲裁链接器错误
OSX Disk Arbitration linker errors
尝试使用有效的 clang 编译我的 C++ 应用程序,但我收到以下 linker 错误:
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 网站上查看了磁盘仲裁的官方文档,但这很糟糕,因为它甚至没有告诉您要包含哪个库文件,更不用说要 link 到什么了。
我正在使用 CMake 来设置我的构建链。
您需要在链接器参数中使用 -framework DiskArbitration
。
尝试使用有效的 clang 编译我的 C++ 应用程序,但我收到以下 linker 错误:
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 网站上查看了磁盘仲裁的官方文档,但这很糟糕,因为它甚至没有告诉您要包含哪个库文件,更不用说要 link 到什么了。
我正在使用 CMake 来设置我的构建链。
您需要在链接器参数中使用 -framework DiskArbitration
。