2012-07-20 11 views
8

Problems linking against GLFW in OSXGLFW vinculación tema en el Makefile en OSX Lion

he leído esto ya, pero parece ser una cuestión diferente conmigo.

El comando siendo corrió en el makefile es,

g++ -o main main.cpp -lglfw -framework Cocoa -framework OpenGL 

El error que estoy recibiendo cuando corro el makefile es,

Undefined symbols for architecture x86_64: 
    "_IOMasterPort", referenced from: 
     __glfwInitJoysticks in libglfw.a(cocoa_joystick.o) 
    "_IOServiceMatching", referenced from: 
     __glfwInitJoysticks in libglfw.a(cocoa_joystick.o) 
    "_IOServiceGetMatchingServices", referenced from: 
     __glfwInitJoysticks in libglfw.a(cocoa_joystick.o) 
    "_IOIteratorNext", referenced from: 
    __glfwInitJoysticks in libglfw.a(cocoa_joystick.o) 
    "_IORegistryEntryCreateCFProperties", referenced from: 
     __glfwInitJoysticks in libglfw.a(cocoa_joystick.o) 
    "_IOCreatePlugInInterfaceForService", referenced from: 
     __glfwInitJoysticks in libglfw.a(cocoa_joystick.o) 
ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status 
make: *** [all] Error 1 

Respuesta

16

Añadir a -framework IOKit opciones g ++.

+0

¡Muchas gracias! – snarehanger

+0

Me salvaste el día :-) – Mayoneez

+1

Solo agrego algunos detalles aquí: se necesita el framework IOKit porque es utilizado por el soporte de joystick OS X recientemente agregado. – elmindreda

0

Thsnks a @ Mārtiņš Možeiko, que resuelve una parte del problema, pero para mí no eran todavía unos mensajes de error:

Undefined symbols for architecture x86_64: 
    "_CVDisplayLinkCreateWithCGDisplay", referenced from: 
     __glfwSetVideoMode in libglfw3.a(cocoa_monitor.m.o) 
     __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o) 
     __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o) 
    "_CVDisplayLinkGetNominalOutputVideoRefreshPeriod", referenced from: 
     _vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.m.o) 
    "_CVDisplayLinkRelease", referenced from: 
     __glfwSetVideoMode in libglfw3.a(cocoa_monitor.m.o) 
     __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o) 
     __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o) 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make[1]: *** [scop] Error 1 
make: *** [scop] Error 2 

Para resolverlo, yo también tenía que añadir el marco CoreVideo.

-framework Cocoa -framework IOKit -framework CoreVideo -framework OpenGL 
Cuestiones relacionadas