Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Please Help!! Symbol(s) not found for architecture x86_64 issue
Forum Updated to NodeBB v4.3 + New Features

Please Help!! Symbol(s) not found for architecture x86_64 issue

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 237 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dboostudio
    wrote on last edited by
    #1

    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/QHotkey

    watch.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
    880a0654-8257-4a83-ba0e-4d4559fc2a35-image.png

    yesterday, this code build fine. but today i faced with it....
    please help....

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      Have you linked Carbon? As in the qhotkey.prc.

      D 1 Reply Last reply
      2
      • B Bonnie

        Have you linked Carbon? As in the qhotkey.prc.

        D Offline
        D Offline
        dboostudio
        wrote on last edited by dboostudio
        #3

        @Bonnie Oh, thank you! I didn't check that part! After add .prc file, it build successfully!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved