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. Unresolved External Symbol....I'm getting this error: LINK2019 Unresolved External Symbol in my exercise code. I actually try to implement it from a youtube video and i'm still getting this error.

Unresolved External Symbol....I'm getting this error: LINK2019 Unresolved External Symbol in my exercise code. I actually try to implement it from a youtube video and i'm still getting this error.

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 4 Posters 3.8k 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.
  • J Offline
    J Offline
    JadeN001
    wrote on 8 Apr 2018, 06:42 last edited by JadeN001 4 Aug 2018, 06:59
    #1

    Unresolved External Symbol....I'm getting this error: LINK2019 Unresolved External Symbol in my exercise code. I actually try to implement it from a youtube video and i'm still getting this error.
    First I implemented client code in one computer lets call it computer A and I got LINK2019 error, I ran same code in different computer lets call it computer B and it worked. now i'm running server code in computer B and getting this LINK2019 error again...can anyone suggest anything !!!

    I was reading in QT Forum and I read somewhere that the library files could be corrupted ...how can we know it ?

    and still LINK2019 error is unsolved...need suggestions.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 8 Apr 2018, 07:03 last edited by
      #2

      Hi
      You must show some code.
      Also show the pro file where you link to the LIB/DLL
      and maybe link to the video your are following.
      Would also help with a screen shot of what you have in the lib folder.

      Else its pretty darn impossible to guess at :)

      1 Reply Last reply
      1
      • J Offline
        J Offline
        JadeN001
        wrote on 8 Apr 2018, 11:16 last edited by
        #3

        thanks mrjj for responding...
        https://www.youtube.com/watch?v=iKtCXUHsV70
        thats the link of the video ...i hope i'm not violating any copyrights.

        main.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl myserver::myserver(class QObject *)" (??0myserver@@QEAA@PEAVQObject@@@Z) referenced in function main
        main.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl myserver::StartServer(void)" (?StartServer@myserver@@QEAAXXZ) referenced in function main

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 8 Apr 2018, 11:23 last edited by mrjj 4 Aug 2018, 11:23
          #4

          Hi
          if linking to other sites breaks copyright, i think whole internet is in troubles ;)

          anyway, since this demo uses network, you must have

          QT += network

          in the .pro file.
          (if you add it, make SURE to run qmake for menu after)

          however, it seems to complain about your own class and not something QTcpServer
          related.

          Would it be possible for your to zip and link your project here ?
          I could have a fst look and see.

          Its most likely something trivial as Lnk do not seem to use external lib or anything else that can give such errors.

          Can you show your code for main.cpp ?

          J 1 Reply Last reply 8 Apr 2018, 11:52
          2
          • J Offline
            J Offline
            JadeN001
            wrote on 8 Apr 2018, 11:39 last edited by
            #5

            4_1523187552476_pro.jpeg 3_1523187552475_mythreadh.jpeg 2_1523187552475_mythreadcpp.jpeg 1_1523187552475_myserverh.jpeg 0_1523187552474_myserveercpp.jpeg

            1 Reply Last reply
            0
            • M mrjj
              8 Apr 2018, 11:23

              Hi
              if linking to other sites breaks copyright, i think whole internet is in troubles ;)

              anyway, since this demo uses network, you must have

              QT += network

              in the .pro file.
              (if you add it, make SURE to run qmake for menu after)

              however, it seems to complain about your own class and not something QTcpServer
              related.

              Would it be possible for your to zip and link your project here ?
              I could have a fst look and see.

              Its most likely something trivial as Lnk do not seem to use external lib or anything else that can give such errors.

              Can you show your code for main.cpp ?

              J Offline
              J Offline
              JadeN001
              wrote on 8 Apr 2018, 11:52 last edited by
              #6

              @mrjj here is what my code looks like or should I say the code that i was trying to learn looks like...I have tried using int and qintptr as well. the error remains same in my computer.
              and yeah Thanks @mrjj .

              J 1 Reply Last reply 9 Apr 2018, 05:19
              0
              • J JadeN001
                8 Apr 2018, 11:52

                @mrjj here is what my code looks like or should I say the code that i was trying to learn looks like...I have tried using int and qintptr as well. the error remains same in my computer.
                and yeah Thanks @mrjj .

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 9 Apr 2018, 05:19 last edited by
                #7

                @JadeN001 Somewhere in your code you're calling StartServer(), but the name of the method is startserver(). Change it. And do a complete rebuild.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                J 1 Reply Last reply 9 Apr 2018, 05:41
                2
                • J jsulm
                  9 Apr 2018, 05:19

                  @JadeN001 Somewhere in your code you're calling StartServer(), but the name of the method is startserver(). Change it. And do a complete rebuild.

                  J Offline
                  J Offline
                  JadeN001
                  wrote on 9 Apr 2018, 05:41 last edited by
                  #8

                  @jsulm thanks
                  That caught my eye too so I've cleared it but the first error remains as it was.

                  main.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl myserver::myserver(class QObject *)" (??0myserver@@QEAA@PEAVQObject@@@Z) referenced in function main

                  and

                  moc_myserver.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl myserver::addPendingConnection(class QTcpSocket *)" (?addPendingConnection@myserver@@QEAAXPEAVQTcpSocket@@@Z) referenced in function "private: static void __cdecl myserver::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall@myserver@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z)

                  it also shows a message in red which says.. "File not found:moc_myserver.obj"

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 9 Apr 2018, 06:43 last edited by
                    #9

                    Hi,

                    Looks like you did not implement addPendingConnection (at least from the code you posted).

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    J 1 Reply Last reply 9 Apr 2018, 07:06
                    2
                    • S SGaist
                      9 Apr 2018, 06:43

                      Hi,

                      Looks like you did not implement addPendingConnection (at least from the code you posted).

                      J Offline
                      J Offline
                      JadeN001
                      wrote on 9 Apr 2018, 07:06 last edited by
                      #10

                      @SGaist thanks

                      so how does that work !! and whats the flow of the whole sending and receiving functions or Signals and slots for client socket !

                      should I create ready read, byteswritten and addPendingConnection of my own or should I just call those signals and attach them to the function or slots that I'd create!!?

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 9 Apr 2018, 21:41 last edited by
                        #11

                        When you declare a slot, you have to implement it otherwise you have missing code. moc generates code that will use that slot.

                        Did you read the Signals And Slots chapter of Qt's documentation ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        J 1 Reply Last reply 10 Apr 2018, 05:33
                        2
                        • S SGaist
                          9 Apr 2018, 21:41

                          When you declare a slot, you have to implement it otherwise you have missing code. moc generates code that will use that slot.

                          Did you read the Signals And Slots chapter of Qt's documentation ?

                          J Offline
                          J Offline
                          JadeN001
                          wrote on 10 Apr 2018, 05:33 last edited by
                          #12

                          @SGaist yes I have,Thank you. But the flow confuses me here.

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 10 Apr 2018, 21:23 last edited by
                            #13

                            What do you mean by flow ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            J 1 Reply Last reply 11 Apr 2018, 06:32
                            0
                            • S SGaist
                              10 Apr 2018, 21:23

                              What do you mean by flow ?

                              J Offline
                              J Offline
                              JadeN001
                              wrote on 11 Apr 2018, 06:32 last edited by
                              #14

                              @SGaist What I mean is, as for readyRead(): This signal is emitted once every time new data is available for reading... So does it mean that once i connect this signal to the slot I created to read or Receive data would get called every time when someone sends data!!?

                              now bytesWritten(qint64 bytes): This signal is emitted every time a payload of data has been written to the device's current write channel....So should I consider that if I connect this signal to the slot which sends data from my side it will get called every time !!?

                              my code puts me in the blocking mode sometimes. and whats the best way to connect signal from one class to the slot of some other class !!

                              thanks in advance @SGaist and anyone who responses back.

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on 11 Apr 2018, 06:49 last edited by
                                #15

                                It will be called every time new data has arrived which might not be exactly when your device sends it (depending on the speed of the channel, system load, application load etc.) Usually you won't see any delay but it's not instantaneous.

                                That's the goal of signals and slots, once connected the slots are getting called each time a signal is fired.

                                What do you mean by "puts me in the blocking mode" ?

                                The best way is to do the connections in the class that manages these two objects.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                J 1 Reply Last reply 11 Apr 2018, 07:08
                                1
                                • S SGaist
                                  11 Apr 2018, 06:49

                                  It will be called every time new data has arrived which might not be exactly when your device sends it (depending on the speed of the channel, system load, application load etc.) Usually you won't see any delay but it's not instantaneous.

                                  That's the goal of signals and slots, once connected the slots are getting called each time a signal is fired.

                                  What do you mean by "puts me in the blocking mode" ?

                                  The best way is to do the connections in the class that manages these two objects.

                                  J Offline
                                  J Offline
                                  JadeN001
                                  wrote on 11 Apr 2018, 07:08 last edited by
                                  #16

                                  @SGaist the code I've posted above , I've added a few more slots and functions in it. so when I'm asking a client to enter its ID from server side ...server is supposed to read when there's something to read, instead it reads nothing when client actually sends its ID and then at second attempt server reads it....and now my client is in blocking mode as it can't read or write .
                                  now if I remove this asking for ID function "readClientID() " from server side, client and server both works fine .

                                  when I debugged the server side, I found that sometimes when client sends its ID, readyRead() signal triggers and it calls the slot which actually receives data instead the function which actually reads ID. I have a signal which is emmited everytime new client comes and that signal is connected to readClientID.

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 11 Apr 2018, 21:11 last edited by
                                    #17

                                    From the looks of it, you are expecting to get all of your data at once when readyRead is fired which likely won't happen especially when using TCP. You have to establish a protocol to ensure you got all the data you are expecting or using something like QDataStream transactions.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    J 1 Reply Last reply 17 Apr 2018, 10:35
                                    1
                                    • S SGaist
                                      11 Apr 2018, 21:11

                                      From the looks of it, you are expecting to get all of your data at once when readyRead is fired which likely won't happen especially when using TCP. You have to establish a protocol to ensure you got all the data you are expecting or using something like QDataStream transactions.

                                      J Offline
                                      J Offline
                                      JadeN001
                                      wrote on 17 Apr 2018, 10:35 last edited by
                                      #18

                                      @SGaist thanks
                                      I'm getting the same error while using QSemaphore .

                                      J 1 Reply Last reply 17 Apr 2018, 11:05
                                      0
                                      • J JadeN001
                                        17 Apr 2018, 10:35

                                        @SGaist thanks
                                        I'm getting the same error while using QSemaphore .

                                        J Offline
                                        J Offline
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on 17 Apr 2018, 11:05 last edited by
                                        #19

                                        @JadeN001 What same error? Can you post the error?

                                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0

                                        7/19

                                        9 Apr 2018, 05:19

                                        topic:navigator.unread, 12
                                        • Login

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