Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. How to use a DLL on Qt 6 with MSVC 2019 64bit compiler?
Forum Updated to NodeBB v4.3 + New Features

How to use a DLL on Qt 6 with MSVC 2019 64bit compiler?

Scheduled Pinned Locked Moved Solved Qt 6
6 Posts 3 Posters 789 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    DubleDroxon442
    wrote on last edited by
    #1

    I'm currently working on setting up a Vectornav VN-200 using the programming library that they provide on their website. The file that I downloaded did not come with any .lib or .dll files to link to, but it came with all of the .cpp and .h files needed for the project. So I manually added them into a new widget project.

    However, when I attempt to build the files, I get these errors:

    serialport.obj:-1: error: LNK2019: unresolved external symbol __imp_RegEnumValueW referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl vn::xplat::SerialPort::getPortNames(void)" (?getPortNames@SerialPort@xplat@vn@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)

    serialport.obj:-1: error: LNK2019: unresolved external symbol __imp_RegOpenKeyExW referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl vn::xplat::SerialPort::getPortNames(void)" (?getPortNames@SerialPort@xplat@vn@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)

    serialport.obj:-1: error: LNK2019: unresolved external symbol __imp_RegQueryInfoKeyW referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl vn::xplat::SerialPort::getPortNames(void)" (?getPortNames@SerialPort@xplat@vn@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)

    I googled each of the functions, and they appear to come from a library in System32 called advapi32.dll, and I think the issue I'm having would be solved if I were able to get the compiler to include this library in my project. I found a guide to do it with a MinGW compiler on Qt 6, but I haven't found one on how to do it with the MSVC compiler that I have to use for this project. Any help would be appreciated.

    raven-worxR 1 Reply Last reply
    0
    • D DubleDroxon442

      I'm currently working on setting up a Vectornav VN-200 using the programming library that they provide on their website. The file that I downloaded did not come with any .lib or .dll files to link to, but it came with all of the .cpp and .h files needed for the project. So I manually added them into a new widget project.

      However, when I attempt to build the files, I get these errors:

      serialport.obj:-1: error: LNK2019: unresolved external symbol __imp_RegEnumValueW referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl vn::xplat::SerialPort::getPortNames(void)" (?getPortNames@SerialPort@xplat@vn@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)

      serialport.obj:-1: error: LNK2019: unresolved external symbol __imp_RegOpenKeyExW referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl vn::xplat::SerialPort::getPortNames(void)" (?getPortNames@SerialPort@xplat@vn@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)

      serialport.obj:-1: error: LNK2019: unresolved external symbol __imp_RegQueryInfoKeyW referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl vn::xplat::SerialPort::getPortNames(void)" (?getPortNames@SerialPort@xplat@vn@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)

      I googled each of the functions, and they appear to come from a library in System32 called advapi32.dll, and I think the issue I'm having would be solved if I were able to get the compiler to include this library in my project. I found a guide to do it with a MinGW compiler on Qt 6, but I haven't found one on how to do it with the MSVC compiler that I have to use for this project. Any help would be appreciated.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @DubleDroxon442
      did you link against advapi32.lib?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • D Offline
        D Offline
        DubleDroxon442
        wrote on last edited by
        #3

        @raven-worx I tried to look for the advapi32.lib file in System32, but I only found the advapi32.dll file. Do I have to download a .lib version from the internet, or am I not looking in the right place?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You should not download any lib from somewhere in the internet. Advapi32.lib is normally shipped with the Windows SDK which is automatically installed with MSVC. Also a proper MinGW environment should supply this import lib.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3
          • D Offline
            D Offline
            DubleDroxon442
            wrote on last edited by
            #5

            @Christian-Ehrlicher I found the .lib file in the windows sdk, just like you told me and got the program compiled. Thank you very much!

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DubleDroxon442
              wrote on last edited by
              #6

              oh and @raven-worx thank you too

              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