【问题标题】:Linking Framework in Xcode 5.0.2Xcode 5.0.2 中的链接框架
【发布时间】:2013-12-05 07:40:22
【问题描述】:

我正在尝试在 Xcode 5.0.2 的程序中添加现有的应用程序服务框架,但是,在终端中执行“make”进行编译时出现以下错误。

Undefined symbols for architecture x86_64:
  "_CGEventCreateKeyboardEvent", referenced from:
      _main in main-gNfV8b.o
  "_CGEventPost", referenced from:
      _main in main-gNfV8b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1

我使用“添加文件”将应用程序框架添加到我的项目中,并且包含了正确的头文件。我做错了什么?

这是我的代码的重要sn-ps:

#include <stdio.h>
#include <ApplicationServices/ApplicationServices.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

int main(int argc, const char* argv[])
{
     CGEventRef plus_on, plus_off;

     plus_on = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)31, true);
     plus_off = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)31, false);

     CGEventPost(kCGHIDEventTap, plus_on);

     CGEventPost(kCGHIDEventTap, plus_off);

     return 0;
}

【问题讨论】:

    标签: frameworks compilation linker xcode5 keyboard-events


    【解决方案1】:

    更新 - 我仍然无法在终端中链接/编译,但它在 Xcode 中成功运行。不知道为什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多