Adding libraries in Qt with MSVC 2019 compiler
-
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.
-
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.
@DubleDroxon442 Isn't this exact same question as in https://forum.qt.io/topic/133740/how-to-use-a-dll-on-qt-6-with-msvc-2019-64bit-compiler ?
-
Dupe of https://forum.qt.io/topic/133740 - closed.