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. Signals in the DLL giving unresolved external symbol error...

Signals in the DLL giving unresolved external symbol error...

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.5k 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.
  • T Offline
    T Offline
    TheCrowKaka
    wrote on last edited by
    #1

    Hello

    I have made a library with this header file. This is library created to be used with C# and vb.net and follows the hierarchyax example.

    #ifndef NEWCOSMIC17_H
    #define NEWCOSMIC17_H
    
    #include <QObject>
    
    class NewCosmic17 : public QObject
    {
    
        Q_OBJECT
        Q_CLASSINFO("ClassID","{4B2125A6-746A-4BDA-8F20-D2B97DE8839E}")
        Q_CLASSINFO("InterfaceID","{FC4F46E8-7875-4157-BFD7-2A448BD73E9B}")
        Q_CLASSINFO("EventsID","{41D6CF05-462F-4DCE-A328-8037659BCDC0}")
    
    public:
        NewCosmic17(QObject *parent = nullptr);
        ~NewCosmic17();
    
    //signals:
        /*
         * this signal is emitted when ever the state of machine changes or
         * a command to change the state of machine is called.
         *
         * */
        void MachineState(bool isConnected);
        /*
         * This signal is emitted whenever an error occurs.
         * */
        void ErrorEmitted(int ErrNum,QString ErrDescript);  //
        /*
         * This signal is emitted whenever the marking complete signal is recieved
         * from the marking machine.
         * */
        void MarkingComplete();
    
        /*
         * This signal is emitted whenever marking is stopped with a stop button.
         * */
        void MarkingStopped();
    
    public slots:
        int ConnecttoMachine(QString ipaddress);
        void DisConnect();
        int StartMarking(bool issimulate);
        int AssignDesign(QString designnamewithpath);
    
    private:
        void macstate(bool value);
    
        void StartBtnTriggered();
    
        void MarkComp();
    
        void EmStopisPressed();
    
        void DisconMachine();
    };
    
    #endif // NEWCOSMIC17_H
    

    Now, if i remove the signals given here, the library compiles well.

    However, with the signals, it gives errors...

    Creating library release\newCosmic171.lib and object release\newCosmic171.exp
    newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::MachineState(bool)" (?MachineState@NewCosmic17@@QAEX_N@Z) referenced in function "private: void __thiscall NewCosmic17::macstate(bool)" (?macstate@NewCosmic17@@AAEX_N@Z)
    newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::ErrorEmitted(int,class QString)" (?ErrorEmitted@NewCosmic17@@QAEXHVQString@@@Z) referenced in function "public: int __thiscall NewCosmic17::AssignDesign(class QString)" (?AssignDesign@NewCosmic17@@QAEHVQString@@@Z)
    newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::MarkingComplete(void)" (?MarkingComplete@NewCosmic17@@QAEXXZ) referenced in function "private: void __thiscall NewCosmic17::MarkComp(void)" (?MarkComp@NewCosmic17@@AAEXXZ)
    newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::MarkingStopped(void)" (?MarkingStopped@NewCosmic17@@QAEXXZ) referenced in function "private: void __thiscall NewCosmic17::EmStopisPressed(void)" (?EmStopisPressed@NewCosmic17@@AAEXXZ)
    release\newCosmic171.dll : fatal error LNK1120: 4 unresolved externals

    Unable to find any clue as to what more is required to be done so that the signals work in the library.

    A Qt Enthusiastic...

    mrjjM 1 Reply Last reply
    0
    • T TheCrowKaka

      Hello

      I have made a library with this header file. This is library created to be used with C# and vb.net and follows the hierarchyax example.

      #ifndef NEWCOSMIC17_H
      #define NEWCOSMIC17_H
      
      #include <QObject>
      
      class NewCosmic17 : public QObject
      {
      
          Q_OBJECT
          Q_CLASSINFO("ClassID","{4B2125A6-746A-4BDA-8F20-D2B97DE8839E}")
          Q_CLASSINFO("InterfaceID","{FC4F46E8-7875-4157-BFD7-2A448BD73E9B}")
          Q_CLASSINFO("EventsID","{41D6CF05-462F-4DCE-A328-8037659BCDC0}")
      
      public:
          NewCosmic17(QObject *parent = nullptr);
          ~NewCosmic17();
      
      //signals:
          /*
           * this signal is emitted when ever the state of machine changes or
           * a command to change the state of machine is called.
           *
           * */
          void MachineState(bool isConnected);
          /*
           * This signal is emitted whenever an error occurs.
           * */
          void ErrorEmitted(int ErrNum,QString ErrDescript);  //
          /*
           * This signal is emitted whenever the marking complete signal is recieved
           * from the marking machine.
           * */
          void MarkingComplete();
      
          /*
           * This signal is emitted whenever marking is stopped with a stop button.
           * */
          void MarkingStopped();
      
      public slots:
          int ConnecttoMachine(QString ipaddress);
          void DisConnect();
          int StartMarking(bool issimulate);
          int AssignDesign(QString designnamewithpath);
      
      private:
          void macstate(bool value);
      
          void StartBtnTriggered();
      
          void MarkComp();
      
          void EmStopisPressed();
      
          void DisconMachine();
      };
      
      #endif // NEWCOSMIC17_H
      

      Now, if i remove the signals given here, the library compiles well.

      However, with the signals, it gives errors...

      Creating library release\newCosmic171.lib and object release\newCosmic171.exp
      newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::MachineState(bool)" (?MachineState@NewCosmic17@@QAEX_N@Z) referenced in function "private: void __thiscall NewCosmic17::macstate(bool)" (?macstate@NewCosmic17@@AAEX_N@Z)
      newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::ErrorEmitted(int,class QString)" (?ErrorEmitted@NewCosmic17@@QAEXHVQString@@@Z) referenced in function "public: int __thiscall NewCosmic17::AssignDesign(class QString)" (?AssignDesign@NewCosmic17@@QAEHVQString@@@Z)
      newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::MarkingComplete(void)" (?MarkingComplete@NewCosmic17@@QAEXXZ) referenced in function "private: void __thiscall NewCosmic17::MarkComp(void)" (?MarkComp@NewCosmic17@@AAEXXZ)
      newcosmic17.obj : error LNK2019: unresolved external symbol "public: void __thiscall NewCosmic17::MarkingStopped(void)" (?MarkingStopped@NewCosmic17@@QAEXXZ) referenced in function "private: void __thiscall NewCosmic17::EmStopisPressed(void)" (?EmStopisPressed@NewCosmic17@@AAEXXZ)
      release\newCosmic171.dll : fatal error LNK1120: 4 unresolved externals

      Unable to find any clue as to what more is required to be done so that the signals work in the library.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @TheCrowKaka
      Hi
      You must flag/place under it with
      signals:
      Else the compiler just see a function signature with no body defined and that's an undefined.

      Also to emit signals, there must be an event loop running.
      Its unclear how you handle that.

      1 Reply Last reply
      1
      • T Offline
        T Offline
        TheCrowKaka
        wrote on last edited by
        #3

        Ha Ha

        Thanks mrJJ for pointing out a very silly mistake that I was doing.

        I just happened to comment out the signals: and forgot to uncomment that in the process of solving the other errors that i faced and solved step by step.

        I just uncommented the signals and the library got compiled.

        Thanks for poniting out my mistake.

        A Qt Enthusiastic...

        mrjjM 1 Reply Last reply
        0
        • T TheCrowKaka

          Ha Ha

          Thanks mrJJ for pointing out a very silly mistake that I was doing.

          I just happened to comment out the signals: and forgot to uncomment that in the process of solving the other errors that i faced and solved step by step.

          I just uncommented the signals and the library got compiled.

          Thanks for poniting out my mistake.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @TheCrowKaka
          Super :)
          Well that is why code review is super effective.
          Its far easier to spot something in other code that one's own.

          1 Reply Last reply
          1

          • Login

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