GLWF3的介绍请移步其官网:http://www.glfw.org/docs/latest/index.html
按照其官网上的安装介绍,用cmake从源码安装GLWF3
Building Applications with GLWF3可以见http://www.glfw.org/docs/latest/build.html#build_link_osx
但它给的用命令行模式在Mac OS X上使用的方法是不全的,会导致不少错误,比如:
Undefined symbols for architecture x86_64: "_LMGetKbdType", referenced from: __glfwPlatformGetKeyName in libglfw3.a(cocoa_window.m.o) "_TISCopyCurrentKeyboardLayoutInputSource", referenced from: __glfwPlatformInit in libglfw3.a(cocoa_init.m.o) "_TISGetInputSourceProperty", referenced from: __glfwPlatformInit in libglfw3.a(cocoa_init.m.o) "_kTISPropertyUnicodeKeyLayoutData", referenced from: __glfwPlatformInit in libglfw3.a(cocoa_init.m.o) ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make: *** [myapplicationname] Error 1
准确的编译命令是:
cc -o myprog myprog.c -lglfw3 -framework Carbon -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo
上面的cc要么在环境变量里面定义,要么就换成gcc-mp-x.