Please Help!! Symbol(s) not found for architecture x86_64 issue
Solved
General and Desktop
-
Hi, i'm having a problem with building my application.
I try to build my project after adding below files.To write this code, I refer to the following link.
code Ref : https://github.com/Skycoder42/QHotkeywatch.h
#ifndef WATCH_H #define WATCH_H #include <QDebug> #include<QObject> #include <QThread> #include <QApplication> #include <Carbon/Carbon.h> class Watch : public QObject { Q_OBJECT public: Watch(){}; ~Watch(){}; public: static OSStatus MyHotKeyHandler(EventHandlerCallRef nextHandler,EventRef theEvent, void *userData); void registerHotkeyMac(); void unregisterHotkeyMac(); private: EventHotKeyID gMyHotKeyID; EventHotKeyRef gMyHotKeyRef; EventTypeSpec eventType; QHash<int,EventHotKeyRef>hotkeyArray; public slots: void watchSlot(QString data); signals: void signalWatch(); }; #endif // WATCH_H
watch.cpp
#include "watch.h" OSStatus Watch::MyHotKeyHandler(EventHandlerCallRef nextHandler,EventRef theEvent, void *userData) { Q_UNUSED(userData); Q_UNUSED(nextHandler); EventHotKeyID hkCom; GetEventParameter(theEvent,kEventParamDirectObject,typeEventHotKeyID,NULL, sizeof(hkCom),NULL,&hkCom); int l = hkCom.id; qDebug()<<"hotkey pressed!!!!!!!!!"<<l; return noErr; } void Watch::registerHotkeyMac(){ //Register All Keyboard to hotkey eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; InstallApplicationEventHandler(&Watch::MyHotKeyHandler,1,&eventType,NULL,NULL); gMyHotKeyID.id = 0; RegisterEventHotKey( kVK_ANSI_Q, cmdKey, gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef); hotkeyArray.insert(gMyHotKeyID.id, gMyHotKeyRef); gMyHotKeyID.id = 1; RegisterEventHotKey( kVK_ANSI_0, NULL, gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef); hotkeyArray.insert(gMyHotKeyID.id, gMyHotKeyRef); gMyHotKeyID.id = 2; RegisterEventHotKey( kVK_ANSI_1, NULL, gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef); hotkeyArray.insert(gMyHotKeyID.id, gMyHotKeyRef); //.... } void Watch::unregisterHotkeyMac() { for(int i=124;i>=0;i--){ UnregisterEventHotKey(hotkeyArray.value(i)); } } void Watch::watchSlot(QString data){ if(data == "1") { qDebug() << "watchCheck = true"; registerHotkeyMac(); } else { qDebug() << "watchCheck = false"; unregisterHotkeyMac(); } }
main.cpp
#include "watch.h" int main(int argc, char *argv[]) { // Watch watch; QObject *pageMainObject = engine.rootObjects()[0]; //connect signal from qml to watchslot QObject::connect(pageMainObject, SIGNAL(watchSignal(QString)),&watch, SLOT(watchSlot(QString))); // }
Compile Output
yesterday, this code build fine. but today i faced with it....
please help....