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. [SOLVED] Can't link static library to executable - missing declarations?
Forum Update on Monday, May 27th 2025

[SOLVED] Can't link static library to executable - missing declarations?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 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.
  • P Offline
    P Offline
    Peppy
    wrote on 14 Nov 2011, 10:37 last edited by
    #1

    Here I am, again. This is output from Output panel (Compiling EXE with Project.Global.lib (static library)).
    @
    Project.Global.lib(SingleCoreApplication.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QLocalServer::listen(class QString const &)" (_imp?listen@QLocalServer@@QAE_NABVQString@@@Z) referenced in function "protected: void __thiscall Project::Global::SingleCoreApplication::init(void)" (?init@SingleCoreApplication@Global@Project@@IAEXXZ)
    @

    Something is missing...it's not available to linker, but what? I think it's missing Qt Classes, but I am not sure...

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on 14 Nov 2011, 10:49 last edited by
      #2

      Do you want to link statically against the Qt library? Did you build a static version of the Qt library? Do you actually use the static build (you linker is obviously looking for an imported symbol from a shared library)?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Peppy
        wrote on 14 Nov 2011, 10:54 last edited by
        #3

        No. I am building application, which takes global static library Project.Global.lib, which includes classes SingleCoreApplication (SingleApplication). No, I didn't build static Qt libraries (Do I need it build?)

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on 14 Nov 2011, 11:06 last edited by
          #4

          No you don't. Did you build the static lib against the same version of Qt?

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Peppy
            wrote on 14 Nov 2011, 11:07 last edited by
            #5

            Yes, I do it on one place.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on 14 Nov 2011, 11:13 last edited by
              #6

              Just to be sure: have you added the network module to your .pro file?

              1 Reply Last reply
              0
              • P Offline
                P Offline
                Peppy
                wrote on 14 Nov 2011, 11:20 last edited by
                #7

                To Library or Application? To library yes, to application not.

                DONE. It works, but. It don't show any console window (application is running)...

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on 14 Nov 2011, 12:39 last edited by
                  #8

                  Check if you are missing a CONFIG += console in your .pro and if the subsystem type is Console (/SUBSYSTEM:CONSOLE) if you are using MSVS.

                  1 Reply Last reply
                  0

                  1/8

                  14 Nov 2011, 10:37

                  • Login

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