Cocoa Undefined symbols “_GetCurrentKeyModifiers”


This post was originally published in 2012
It may contain stale & outdated information. Or it may have grown more awesome with age, like the author.

Merging some convenient (but old) code I found laying around into a new project, I came across this build error:

Undefined symbols for architecture i386:
  "_GetCurrentKeyModifiers", referenced from:
      -[Class mouseDown:] in Class.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Scrolling through the source for this class, I found calls to GetCurrentKeyModifiers() scattered about. This function is from Carbon, the AppKit way to get the same thing is:

[[NSApp currentEvent] modifierFlags]

Swapping out GetCurrentKeyModifiers() calls for this cleared those build errors right up.

Comments (1) | Trackback