如何更正“架构 x86_64 的未定义符号” I/O Kit 出现问题?
我正在运行 OSX Lion,并希望使用引用的 I/O Kit 注册睡眠通知 此处。
当我编译代码时,我得到了以下符号的 Undefined Symbols for Architecture x86_64
:IOAllowPowerChange
、IORegisterForSystemPower
和 IONotificationPortGetRunLoopSource
。
我查了苹果的文档,都是公共函数。关于我为什么会遇到这些问题有什么建议吗?
I am running OSX Lion and would like to register for sleep notifications using I/O Kit as referenced here.
When I compile the code, I get Undefined symbols for architecture x86_64
for the following symbols IOAllowPowerChange
, IORegisterForSystemPower
and IONotificationPortGetRunLoopSource
.
I searched in Apple's documentation and they are all public functions. Any suggestions as to why I am getting those issues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想说你需要链接到 IOKit.framework
I would say you need to link to the IOKit.framework
我不太清楚为什么它很重要,但如果我在静态函数中调用任何 I/O 工具包的函数,编译器不会报告问题,但如果我不使用静态函数,则会收到错误。
I'm not too sure why it matters but if I call any of the I/O kit's functions within a static function, the compiler will not report a problem, but if I don't use a static function I get an error.