2015-07-02 11:42:56 UTC
I'm trying to add an Objective C category to the QCocoaApplicationDelegate
class that is defined by the Mac OS X Cocoa platform plugin, to add /
override some methods.
The QCocoaApplicationDelegate is defined in Qt's source folder
My code for the category is as simple as this:
// Code in osx_app_delegate.mm
@interface QCocoaApplicationDelegate (AppDelegate)
@implementation QCocoaApplicationDelegate (AppDelegate)
But when I try to compile the code, I get the following error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_QCocoaApplicationDelegate", referenced from:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
Doing the same (adding a category to the app delegate) on IOS works
I assume that is because the platform plugin on IOS is linked statically,
whereas on OSX it is linked dynamically.
I tried manually linking the cocoa plugin dylib file at link stage like so:
LIBS += -L/Users/X/Dev/Qt/5.4/clang_64/plugins/platforms -lqcocoa
But this doesn't help either.
Is there no way to add the category if the platform plugin is dynamically
Is the only option to statically compile Qt, and therefore the platform
plugin as well?