Hi,
I'm trying to embed some Cocoa-Objective C code in my Qt application(Using Qt Creator) to receive DockClickEvent. but when I want to compile it I get this linker error for the objective C part.
Undefined symbols:
"__objc_empty_vtable", referenced from:
_OBJC_METACLASS_$_DockIconClickEventHandler in dockiconclick.o
_OBJC_CLASS_$_DockIconClickEventHandler in dockiconclick.o
and here is my objective C code
Please help me.
I'm trying to embed some Cocoa-Objective C code in my Qt application(Using Qt Creator) to receive DockClickEvent. but when I want to compile it I get this linker error for the objective C part.
Undefined symbols:
"__objc_empty_vtable", referenced from:
_OBJC_METACLASS_$_DockIconClickEventHandler in dockiconclick.o
_OBJC_CLASS_$_DockIconClickEventHandler in dockiconclick.o
and here is my objective C code
Code:
#include <Cocoa/Cocoa.h>
#include <QDebug>
#include "dockiconclick.h"
@interface DockIconClickEventHandler : NSObject
{
@public
DockIconClickMonitor* monitor;
}
- (void)handle:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
@end
@implementation DockIconClickEventHandler
- (void)handle:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
if (monitor)
monitor->emitEvent();
}
@end
class DockIconClickMonitor::Private
{
public:
DockIconClickEventHandler* handler;
};
DockIconClickMonitor::DockIconClickMonitor()
{
d = new DockIconClickMonitor::Private();
d->handler = [[DockIconClickEventHandler alloc] init];
d->handler->monitor = this;
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:d->handler
andSelector:@selector(handle:withReplyEvent:)
forEventClass:kCoreEventClass
andEventID:kAEReopenApplication];
}
DockIconClickMonitor::~DockIconClickMonitor()
{
delete d;
}
void DockIconClickMonitor::emitEvent()
{
emit dockIconClicked();
}
Please help me.