Hi.

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
"src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h".

My code for the category is as simple as this:

// Code in osx_app_delegate.mm

#include <qglobal.h>

#include <Cocoa/Cocoa.h>


@interface QCocoaApplicationDelegate

@end


@interface QCocoaApplicationDelegate (AppDelegate)

@end



@implementation QCocoaApplicationDelegate (AppDelegate)

@end


But when I try to compile the code, I get the following error:

Undefined symbols for architecture x86_64:

"_OBJC_CLASS_$_QCocoaApplicationDelegate", referenced from:

l_OBJC_$_CATEGORY_QCocoaApplicationDelegate_$_AppDelegate in
osx_app_delegate.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see
invocation)


Doing the same (adding a category to the app delegate) on IOS works
properly.
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
loaded?
Is the only option to statically compile Qt, and therefore the platform
plugin as well?
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to