2013-04-01 40 views
0

我寫了一個Objective-c類,用於使用FSEventStreamCreate()來觀察特定的文件夾。當我在基於GUI的應用程序中使用它時,該類將按預期工作。fsevents命令行

現在我正在嘗試使用這個類編寫一個命令行應用程序。該項目未能鏈接:(

以下是錯誤消息

Undefined symbols for architecture x86_64:
"_FSEventStreamCreate", referenced from:
-[MyFSWatcher initializeEventStream] in MyFSWatcher.o
"_FSEventStreamScheduleWithRunLoop", referenced from:
-[MyFSWatcher initializeEventStream] in MyFSWatcher.o
"_FSEventStreamStart", referenced from:
-[MyFSWatcher initializeEventStream] in MyFSWatcher.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1

我猜我錯過了一些連接標誌。有人請指出這一點?

回答

3

的FSEvents API是一部分CoreServices,所以你需要對抗鏈接

如果你從命令行,使用編譯:

clang -framework CoreServices ...

+0

是的,這是正確的。我只是閱讀:https://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html – vrrathod