Estoy intentando utilizar el kit de E/S y he vinculado correctamente el kit de E/S.¿Por qué las funciones estáticas eliminan símbolos indefinidos en Xcode?
Cuando uso una función en el kit de E/S y no la llamo dentro de una función estática, aparece el siguiente error Undefined symbols for architecture x86_64
.
Aquí se muestra un ejemplo para suprimir el error
static void test(void)
{
if (IORegisterForSystemPower(...))
{
}
}
Aquí hay un ejemplo que hará que el error.
void test(void)
{
if (IORegisterForSystemPower(...))
{
}
}
Cualquier sugerencia en cuanto a por qué ocurre esto?
EDIT:
Estos son los mensajes de error exactos:
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)
¿Puedes pegar la lista completa de mensajes de error? Por ejemplo, ¿se queja del símbolo IORegisterForSystemPower? – jman
He agregado mensajes de error. Por favor mira arriba. – David