【发布时间】:2011-12-02 18:31:01
【问题描述】:
我正在尝试使用 I/O 套件并已正确链接到 I/O 套件。
当我在 I/O 套件中使用函数并且不在静态函数中调用它时,我收到以下错误 Undefined symbols for architecture x86_64。
这是一个抑制错误的例子
static void test(void)
{
if (IORegisterForSystemPower(...))
{
}
}
这是一个会导致错误的示例。
void test(void)
{
if (IORegisterForSystemPower(...))
{
}
}
关于为什么会发生这种情况的任何建议?
编辑:
以下是确切的错误消息:
Undefined symbols for architecture x86_64:
"_IORegisterForSystemPower", referenced from:
_registerNotificaitonUsingIOKit in AppDelegate.o
"_IONotificationPortGetRunLoopSource", referenced from:
_registerNotificaitonUsingIOKit in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
【问题讨论】:
-
你能粘贴完整的错误信息列表吗?例如,它是否抱怨符号 IORegisterForSystemPower?
-
我添加了错误消息。请参见上文。
标签: objective-c xcode macos linker iokit