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. Linker error when trying to compile my executable
Forum Updated to NodeBB v4.3 + New Features

Linker error when trying to compile my executable

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 683 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
    PLL3
    wrote on 2 Mar 2023, 12:32 last edited by
    #1

    Hi everyone.

    I'm currently having these LNK2019 errors when trying to compile my application :

    MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qstyle(void)" 
    (?qInitResources_qstyle@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" 
    (??0QApplication@@QEAA@AEAHPEAPEADH@Z)
    
    MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qmessagebox(void)" 
    (?qInitResources_qmessagebox@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" 
    (??0QApplication@@QEAA@AEAHPEAPEADH@Z)
    
    MyHomeMadeLib.lib(qwindowsintegration.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_openglblacklists(void)" 
    (?qInitResources_openglblacklists@@YAHXZ) referenced in function "public: void __cdecl QWindowsIntegrationPrivate::parseOptions(class QWindowsIntegration *,class QList<class QString> const &)" 
    (?parseOptions@QWindowsIntegrationPrivate@@QEAAXPEAVQWindowsIntegration@@AEBV?$QList@VQString@@@@@Z)
    
    MyHomeMadeLib.lib(qwindowscursor.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_cursors(void)" 
    (?qInitResources_cursors@@YAHXZ) referenced in function "public: __cdecl QWindowsCursor::QWindowsCursor(class QPlatformScreen const *)" 
    (??0QWindowsCursor@@QEAA@PEBVQPlatformScreen@@@Z)
    

    My version of Qt is Qt6.2.6, I'm using cmake and here's the configure options I used to build it:

    configure -prefix C:\qt-install-6.2.6 -release -static -feature-relocatable -submodules qtsvg,qtbase
    
    
    

    MyHomeMadeLib.lib is an amalgam of the libs Qt6Core.lib Qt6Gui.lib Qt6Widgets.lib Qt6Svg.lib Qt6SvgWidgets.lib Qt6BundledLibpng.lib Qt6BundledPcre2.lib Qt6BundledHarfbuzz.lib Qt6BundledFreetype.lib and qwindows.lib

    I even tried using all the .lib generated after the Qt build, but I still have the same result.
    This issue isn't new (was already present in Qt6.2.4), and we solved it by slightly modifying the Qt source code. But this hack eventually brought some other issues with it so now i'd like to make things work "cleanly" without modifying Qt's source code.

    Any help or hint would greatly be appreciated, thanks.

    J 1 Reply Last reply 2 Mar 2023, 12:42
    0
    • P PLL3
      2 Mar 2023, 12:32

      Hi everyone.

      I'm currently having these LNK2019 errors when trying to compile my application :

      MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qstyle(void)" 
      (?qInitResources_qstyle@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" 
      (??0QApplication@@QEAA@AEAHPEAPEADH@Z)
      
      MyHomeMadeLib.lib(qapplication.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_qmessagebox(void)" 
      (?qInitResources_qmessagebox@@YAHXZ) referenced in function "public: __cdecl QApplication::QApplication(int &,char * *,int)" 
      (??0QApplication@@QEAA@AEAHPEAPEADH@Z)
      
      MyHomeMadeLib.lib(qwindowsintegration.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_openglblacklists(void)" 
      (?qInitResources_openglblacklists@@YAHXZ) referenced in function "public: void __cdecl QWindowsIntegrationPrivate::parseOptions(class QWindowsIntegration *,class QList<class QString> const &)" 
      (?parseOptions@QWindowsIntegrationPrivate@@QEAAXPEAVQWindowsIntegration@@AEBV?$QList@VQString@@@@@Z)
      
      MyHomeMadeLib.lib(qwindowscursor.cpp.obj) : error LNK2019: unresolved external symbol "int __cdecl qInitResources_cursors(void)" 
      (?qInitResources_cursors@@YAHXZ) referenced in function "public: __cdecl QWindowsCursor::QWindowsCursor(class QPlatformScreen const *)" 
      (??0QWindowsCursor@@QEAA@PEBVQPlatformScreen@@@Z)
      

      My version of Qt is Qt6.2.6, I'm using cmake and here's the configure options I used to build it:

      configure -prefix C:\qt-install-6.2.6 -release -static -feature-relocatable -submodules qtsvg,qtbase
      
      
      

      MyHomeMadeLib.lib is an amalgam of the libs Qt6Core.lib Qt6Gui.lib Qt6Widgets.lib Qt6Svg.lib Qt6SvgWidgets.lib Qt6BundledLibpng.lib Qt6BundledPcre2.lib Qt6BundledHarfbuzz.lib Qt6BundledFreetype.lib and qwindows.lib

      I even tried using all the .lib generated after the Qt build, but I still have the same result.
      This issue isn't new (was already present in Qt6.2.4), and we solved it by slightly modifying the Qt source code. But this hack eventually brought some other issues with it so now i'd like to make things work "cleanly" without modifying Qt's source code.

      Any help or hint would greatly be appreciated, thanks.

      J Offline
      J Offline
      JonB
      wrote on 2 Mar 2023, 12:42 last edited by
      #2

      @PLL3
      https://bugreports.qt.io/browse/QTBUG-91448 ?

      P 1 Reply Last reply 2 Mar 2023, 12:57
      1
      • J JonB
        2 Mar 2023, 12:42

        @PLL3
        https://bugreports.qt.io/browse/QTBUG-91448 ?

        P Offline
        P Offline
        PLL3
        wrote on 2 Mar 2023, 12:57 last edited by
        #3

        @JonB Thanks a lot, that's exactly it ! I'll check the comments and try a few things.

        Thanks again, i've been stuck on this for way too long.

        1 Reply Last reply
        0
        • P PLL3 has marked this topic as solved on 3 Mar 2023, 16:15
        • P Offline
          P Offline
          PLL3
          wrote on 3 Mar 2023, 16:20 last edited by
          #4

          In the link provided by JonB, in the comment chain someone gave the fix, I'll post it here too in case someone comes across this thread:

          In your Qt build directory, under \lib\objects-Release (or objects-Debug if built in debug mode) there are a number of directories ending with resources_X

          Inside those directories i found some .obj files, linking some of those files in my project fixed my missing symbol issue.

          1 Reply Last reply
          0
          • P PLL3 referenced this topic on 9 Mar 2023, 14:25

          1/4

          2 Mar 2023, 12:32

          • Login

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