Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    2
    8
    3466
    Loading More Posts
    • 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
      Peppy last edited by

      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 Reply Quote 0
      • L
        lgeyer last edited by

        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 Reply Quote 0
        • P
          Peppy last edited by

          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 Reply Quote 0
          • L
            lgeyer last edited by

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

            1 Reply Last reply Reply Quote 0
            • P
              Peppy last edited by

              Yes, I do it on one place.

              1 Reply Last reply Reply Quote 0
              • L
                lgeyer last edited by

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

                1 Reply Last reply Reply Quote 0
                • P
                  Peppy last edited by

                  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 Reply Quote 0
                  • L
                    lgeyer last edited by

                    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 Reply Quote 0
                    • First post
                      Last post