Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QT 5.11 from source statically linked using CMake issues
Forum Updated to NodeBB v4.3 + New Features

QT 5.11 from source statically linked using CMake issues

Scheduled Pinned Locked Moved Solved Installation and Deployment
3 Posts 1 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.
  • S Offline
    S Offline
    Slei
    wrote on last edited by
    #1

    Hey,

    I'm currently trying to create a project with statically linked QT built from source.
    I'm using CMake, and I'm getting lots of different unresolved external symbol erros due to some mussing libs I guess.

    I've tried to add one lib after another and now I can't find the rest.

    Currently my CMake libraries looks like this

    sQT
            target_link_libraries(${PROJECT_NAME} PUBLIC
                    Qt5::Core
                    Qt5::Quick
                    Qt5::Multimedia
                    Qt5::QuickControls2
                    Qt5::Widgets
                    )
    
     target_link_libraries(${PROJECT_NAME} PRIVATE
                    sQt
                    Ws2_32.lib
                    Version.lib
                    C:/qt_src/install/lib/qtharfbuzzd.lib
                    C:/qt_src/install/lib/qtlibpngd.lib
                    C:/qt_src/install/lib/qtpcre2d.lib
                    Netapi32.lib
                    userenv.lib
                    C:/qt_src/install/plugins/platforms/qwindowsd.lib
                    C:/qt_src/install/lib/qtfreetyped.lib
                    C:/qt_src/install/lib/libEGLd.lib
                    C:/qt_src/install/lib/libGLESv2d.lib
                    winmm.lib
                    imm32.lib
                    )
    

    And I'm still getting plentyt of those issues but can't find the correct libs to add:

    qwindowsd.lib(qwindowsintegration.obj) : error LNK2019: unresolved external symbol "public: __cdecl QWindowsFontDatabase::QWindowsFontDatabase(void)" (??0QWindowsFontDatabase@@QEAA@XZ) referenced in function "public: virtual class QPlatformFontDatabase * __cdecl QWindowsIntegration::fontDatabase(void)const " (?fontDatabase@QWindowsIntegration@@UEBAPEAVQPlatformFontDatabase@@XZ)
    qwindowsd.lib(qwindowsintegration.obj) : error LNK2019: unresolved external symbol "public: static double __cdecl QWindowsFontDatabase::fontSmoothingGamma(void)" (?fontSmoothingGamma@QWindowsFontDatabase@@SANXZ) referenced in function "public: virtual class QVariant __cdecl QWindowsIntegration::styleHint(enum QPlatformIntegration::StyleHint)const " (?styleHint@QWindowsIntegration@@UEBA?AVQVariant@@W4StyleHint@QPlatformIntegration@@@Z)
    qwindowsd.lib(qwindowsintegration.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl QWindowsFontDatabase::setFontOptions(unsigned int)" (?setFontOptions@QWindowsFontDatabase@@SAXI@Z) referenced in function "public: __cdecl QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(class QStringList const &)" (??0QWindowsIntegrationPrivate@@QEAA@AEBVQStringList@@@Z)
    qwindowsd.lib(qwindowsintegration.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl QFreeTypeFontDatabase::populateFontDatabase(void)" (?populateFontDatabase@QFreeTypeFontDatabase@@UEAAXXZ)
    qwindowsd.lib(qwindowsintegration.obj) : error LNK2001: unresolved external symbol "public: virtual class QFontEngine * __cdecl QFreeTypeFontDatabase::fontEngine(struct QFontDef const &,void *)" (?fontEngine@QFreeTypeFontDatabase@@UEAAPEAVQFontEngine@@AEBUQFontDef@@PEAX@Z)
    and more........ (seems like I'm not allowed to post the whole thing)
    
    
    
    those errors are getting out of control and i would need some help
    
    thanks
    slei~
    1 Reply Last reply
    0
    • S Offline
      S Offline
      Slei
      wrote on last edited by
      #2
      #include <QApplication>
      #include <QPushButton>
      
      #include <QtPlugin>
      Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin);
      
      int main(int argc, char *argv[])
      {
       QApplication app (argc, argv);
      
       QPushButton button ("Hello world !");
       button.show();
      
       return app.exec();
      }
      

      I've also added the plugin stuff on top of the test app.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Slei
        wrote on last edited by
        #3

        I've know just added all libraries from the lib folder, without knowing wich one i need, since it was extremely painful to track down the correct libs.
        I somehow can't really believe this is so complicated to link those libs especially there isn't really a tutorial/list for which libs are required for a simple qt app, or is just much easier with qmake instead of cmake?

        anyway it works now.

        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