Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GLFW linking issue in makefile on OSX Lion

Problems linking against GLFW in OSX

I've read this already but it seems to be a different issue with me.

The command being ran in the makefile is,

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

The error that I'm receiving when I run 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
like image 559
snarehanger Avatar asked Jul 20 '12 02:07

snarehanger


1 Answers

Add -framework IOKit to g++ options.

like image 127
Mārtiņš Možeiko Avatar answered Oct 05 '22 16:10

Mārtiņš Možeiko