Problem with GLFW binding in OSX Lion makefile

Problems related to GLFW on OSX

I read it already, but it seems to be another problem with me.

The command executed in the makefile

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

The error I get when running the makefile is

 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 
+8
c ++ makefile opengl glfw macos
source share
2 answers

Add -framework IOKit to the g ++ options.

+16
source share

Thsnks @ Mārtiņš Možeiko, I solved part of the problem, but there were a few more error messages for me:

 Undefined symbols for architecture x86_64: "_CVDisplayLinkCreateWithCGDisplay", referenced from: __glfwSetVideoMode in libglfw3.a(cocoa_monitor.mo) __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.mo) __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.mo) "_CVDisplayLinkGetNominalOutputVideoRefreshPeriod", referenced from: _vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.mo) "_CVDisplayLinkRelease", referenced from: __glfwSetVideoMode in libglfw3.a(cocoa_monitor.mo) __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.mo) __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.mo) 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 

To solve this problem, I also need to add the CoreVideo infrastructure.

 -framework Cocoa -framework IOKit -framework CoreVideo -framework OpenGL 
0
source share

All Articles