GLFW在OSX Lion上的makefile中链接问题

sna*_*ger 8 c++ opengl macos makefile glfw

在OSX中链接GLFW的问题

我已经读过这篇文章,但这对我来说似乎是一个不同的问题.

在makefile中运行的命令是,

    g++ -o main main.cpp -lglfw -framework Cocoa -framework OpenGL
Run Code Online (Sandbox Code Playgroud)

我运行makefile时收到的错误是,

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
Run Code Online (Sandbox Code Playgroud)

Mār*_*iko 16

添加-framework IOKit到g ++选项.