undefined reference to `sm3_digest'
-
@hhhl01 said in undefined reference to `sm3_digest':
Why does the library have to be 32-bit?
It gets a bit complicated! Your actual Windows is doubtless 64-bit. That can run either 64- or 32-bit applications. Programs or libraries are compiled as either 64- or 32-bit. You cannot mix any 64- and 32-bit stuff within any one application, that and everything it links with must all be one or the other.
Your pasted error message shows that you are building your Qt application as 32-bit (
...MinGW_32bit-Debug...
). Somewhere you elected to do that. That means it will only link successfully against libraries also built 32-bit. If yourgmssl
has actually been built as 64-bit it's not going to work.found that GmSSL is built on standard 64-bit systems, but at the same time, it also supports 32-bit systems
I'm not sure exactly what that means. Let's put it aside for now.
Start by looking inside your
GMSSL\lib
folder. You are looking for a file namedlibgmssl.a
. Do you find that? If so, exactly where? If perchance you do not find that but instead a.lib
file namedgmssl.lib
that would indicate it has been compiled by MSVC and you won't be able to use MInGW. Otherwise if you do have alibgmssl.a
we need to know whether it is 32- or 64-bit. If the latter you would have to change to compiling your own Qt program for 64-bit in order to link with it. -
@JonB Thanks for your reply, I seem to understand what you mean. I just checked that there is only a .lib file named gmssl.lib under GMSSL\lib, which is the library linked to my .pro file. The libgmssl.a file was not found, so the solution is to compile the GMSSL library into 32-bit using mingw? I'm not sure if this is a good approach.
-
@hhhl01 said in undefined reference to `sm3_digest':
that there is only a .lib file named gmssl.lib
The libgmssl.a file was not found
so the solution is to compile the GMSSL library into 32-bit using mingw?
gmssl.lib
means that was compiled with MSVC. You cannot use that to link against anything of yours compiled with MinGW, regardless of bit-ness. You have 2 choices:-
If
gmssl.lib
was supplied to you from whatever the "GMSSL" package is, and you want to use it, you will have to change over to using MSVC instead of MinGW for all your application code you write. You will still have to discover whether the.lib
file is 32- or 64-bit and compile your stuff with MSVC correspondingly. -
If you compile the GMSSL sources yourself you can recompile with MinGW (again, correct 32- or 64-bit for whatever you intend to compile your Qt stuff as), producing a
libgmssl.a
this time, and you will be able to link against that for your stuff compiled with MinGW. You may find that the GMSSL sources can only be compiled with MSVC, not written to allow MinGW: if so you will have to abandon MinGW and do it and your stuff all with MSVC instead.
The instructions for GMSSL really should document all this.
NOTE:
I don't use Windows or MSVC/MinGW. The above is pretty close to correct. The one thing I am not 100% certain about: if, and only if, GMSSL is C only and no C++ it might be that you can link against a generated.lib
file. I say this because I think some Windows system libraries are C-only, are compiled with MSVC and have a.lib
extension yet have to be acceptable to MinGW. If that is your route you would have to await someone who knows about this specific area.P.S.
In http://gmssl.org/docs/install.html my limited knowledge of Chinese ;-) indicates it is intended to be built with MSVC/Visual Studio. What evidence do you have it will ever compile/work with MinGW? -
-
@JonB Sorry it took so long to get back to you.I still haven't been able to solve this problem. I replaced the mingw 32-bit compiler with msvc 64-bit, but it still can't link to the library correctly.
The Chinese meaning here is:
upgrade_protocol.obj : error LNK2019: unresolved external symbol sm3_digest referenced in function "private: class std::vector<unsigned char, class std::allocator<unsigned char>> __cdecl UpgradeProtocol::sm3Hash(class std::vector<unsigned char, class std::allocator<unsigned char>> const &)" (?sm3Hash@UpgradeProtocol@@AEAA?AV?$vector@EV?$allocator@E@std@@@std@@AEBV23@@Z)I don't know if it's the same problem as the one I encountered before. I'm thinking if it's a library problem.Looking forward to your reply, thank you.
-
@JonB I also need to explain that my current development environment is the windows platform.
And the external library I linked to is 64-bit.
I think there is no problem with my build environment, so is it possible that the Windows platform is causing this error? -
-
@jsulm Hello.Thanks Hello.Thanks for your reply. This is my .pro file.
* * * * ``` #------------------------------------------------- # # Project created by QtCreator 2024-07-04T18:09:10 # #------------------------------------------------- CONFIG += c++11 QT += core gui widgets serialport network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = ClientPro TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ widget.cpp \ uart_process.cpp \ lan_process.cpp \ process_thread.cpp \ upgrade_protocol.cpp HEADERS += \ widget.h \ uart_process.h \ lan_process.h \ process_thread.h \ upgrade_protocol.h FORMS += \ widget.ui msvc { QMAKE_CFLAGS += /utf-8 QMAKE_CXXFLAGS += /utf-8 } win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../GmSSL/release/gmssl.lib else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../GmSSL/debug/gmssl.lib else:unix:!macx: LIBS += -L$$PWD/../../GmSSL/gmssl.lib INCLUDEPATH += $$PWD/../../GmSSL/include DEPENDPATH += $$PWD/../../GmSSL/include
And below is the output of the linker. 10:04:40: 为项目ClientPro执行步骤 ... 10:04:40: 正在启动 "D:\qt\Tools\QtCreator\bin\jom\jom.exe" clean D:\qt\Tools\QtCreator\bin\jom\jom.exe -f Makefile.Debug clean del debug\moc_predefs.h 找不到 D:\qtPro\ClientPro\debug\moc_predefs.h del debug\moc_widget.cpp debug\moc_process_thread.cpp debug\moc_upgrade_protocol.cpp del ui_widget.h 找不到 D:\qtPro\ClientPro\debug\moc_widget.cpp 找不到 D:\qtPro\ClientPro\ui_widget.h del debug\main.obj debug\widget.obj debug\uart_process.obj debug\lan_process.obj debug\process_thread.obj debug\upgrade_protocol.obj debug\moc_widget.obj debug\moc_process_thread.obj debug\moc_upgrade_protocol.obj 找不到 D:\qtPro\ClientPro\debug\main.obj del debug\ClientPro.exp debug\ClientPro.vc.pdb debug\ClientPro.ilk debug\ClientPro.idb 找不到 D:\qtPro\ClientPro\debug\ClientPro.exp D:\qt\Tools\QtCreator\bin\jom\jom.exe -f Makefile.Release clean del release\moc_predefs.h del release\moc_widget.cpp release\moc_process_thread.cpp release\moc_upgrade_protocol.cpp del ui_widget.h del release\main.obj release\widget.obj release\uart_process.obj release\lan_process.obj release\process_thread.obj release\upgrade_protocol.obj release\moc_widget.obj release\moc_process_thread.obj release\moc_upgrade_protocol.obj del release\ClientPro.exp 找不到 D:\qtPro\ClientPro\release\moc_predefs.h 找不到 D:\qtPro\ClientPro\release\moc_widget.cpp 找不到 D:\qtPro\ClientPro\ui_widget.h 找不到 D:\qtPro\ClientPro\release\main.obj 找不到 D:\qtPro\ClientPro\release\ClientPro.exp del ClientPro.exp 找不到 D:\qtPro\ClientPro\ClientPro.exp del ClientPro.vc.pdb 找不到 D:\qtPro\ClientPro\ClientPro.vc.pdb del ClientPro.ilk 找不到 D:\qtPro\ClientPro\ClientPro.ilk del ClientPro.idb 找不到 D:\qtPro\ClientPro\ClientPro.idb 10:04:41: 进程"D:\qt\Tools\QtCreator\bin\jom\jom.exe"正常退出。 10:04:41: 正在启动 "C:\Program Files\msvc2017_64\bin\qmake.exe" D:\qtPro\ClientPro\ClientPro.pro -spec win32-msvc "CONFIG+=debug" 10:04:41: 进程"C:\Program Files\msvc2017_64\bin\qmake.exe"正常退出。 10:04:41: 正在启动 "D:\qt\Tools\QtCreator\bin\jom\jom.exe" -f D:/qtPro/ClientPro/Makefile qmake_all jom 1.1.4 - empower your cores 10:04:41: 进程"D:\qt\Tools\QtCreator\bin\jom\jom.exe"正常退出。 10:04:41: 正在启动 "D:\qt\Tools\QtCreator\bin\jom\jom.exe" D:\qt\Tools\QtCreator\bin\jom\jom.exe -f Makefile.Debug "C:\Program Files\msvc2017_64\bin\uic.exe" widget.ui -o ui_widget.h widget.ui: Warning: The name 'layoutWidget' (QWidget) is already in use, defaulting to 'layoutWidget1'. widget.ui: Warning: The name 'layoutWidget' (QWidget) is already in use, defaulting to 'layoutWidget2'. cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\main.obj.4208.0.jom cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\uart_process.obj.4208.15.jom cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\lan_process.obj.4208.15.jom cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\process_thread.obj.4208.31.jom uart_process.cpp lan_process.cpp main.cpp process_thread.cpp cl -Bx"C:\Program Files\msvc2017_64\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E "C:\Program Files\msvc2017_64\mkspecs\features\data\dummy.cpp" 2>NUL >debug\moc_predefs.h "C:\Program Files\msvc2017_64\bin\moc.exe" -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB --compiler-flavor=msvc --include debug/moc_predefs.h -I"C:/Program Files/msvc2017_64/mkspecs/win32-msvc" -ID:/qtPro/ClientPro -ID:/GmSSL/include -I"C:/Program Files/msvc2017_64/include" -I"C:/Program Files/msvc2017_64/include/QtWidgets" -I"C:/Program Files/msvc2017_64/include/QtGui" -I"C:/Program Files/msvc2017_64/include/QtANGLE" -I"C:/Program Files/msvc2017_64/include/QtSerialPort" -I"C:/Program Files/msvc2017_64/include/QtNetwork" -I"C:/Program Files/msvc2017_64/include/QtCore" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\ATLMFC\include" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" process_thread.h -o debug\moc_process_thread.cpp "C:\Program Files\msvc2017_64\bin\moc.exe" -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB --compiler-flavor=msvc --include debug/moc_predefs.h -I"C:/Program Files/msvc2017_64/mkspecs/win32-msvc" -ID:/qtPro/ClientPro -ID:/GmSSL/include -I"C:/Program Files/msvc2017_64/include" -I"C:/Program Files/msvc2017_64/include/QtWidgets" -I"C:/Program Files/msvc2017_64/include/QtGui" -I"C:/Program Files/msvc2017_64/include/QtANGLE" -I"C:/Program Files/msvc2017_64/include/QtSerialPort" -I"C:/Program Files/msvc2017_64/include/QtNetwork" -I"C:/Program Files/msvc2017_64/include/QtCore" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\ATLMFC\include" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" upgrade_protocol.h -o debug\moc_upgrade_protocol.cpp cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\upgrade_protocol.obj.4208.31.jom upgrade_protocol.cpp cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\widget.obj.4208.47.jom widget.cpp "C:\Program Files\msvc2017_64\bin\moc.exe" -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB --compiler-flavor=msvc --include debug/moc_predefs.h -I"C:/Program Files/msvc2017_64/mkspecs/win32-msvc" -ID:/qtPro/ClientPro -ID:/GmSSL/include -I"C:/Program Files/msvc2017_64/include" -I"C:/Program Files/msvc2017_64/include/QtWidgets" -I"C:/Program Files/msvc2017_64/include/QtGui" -I"C:/Program Files/msvc2017_64/include/QtANGLE" -I"C:/Program Files/msvc2017_64/include/QtSerialPort" -I"C:/Program Files/msvc2017_64/include/QtNetwork" -I"C:/Program Files/msvc2017_64/include/QtCore" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\ATLMFC\include" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" widget.h -o debug\moc_widget.cpp cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\moc_process_thread.obj.4208.328.jom moc_process_thread.cpp cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\moc_upgrade_protocol.obj.4208.375.jom moc_upgrade_protocol.cpp main.cpp(10): warning C4189: “codec”: 局部变量已初始化但不引用 cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ClientPro.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\GmSSL\include -I"C:\Program Files\msvc2017_64\include" -I"C:\Program Files\msvc2017_64\include\QtWidgets" -I"C:\Program Files\msvc2017_64\include\QtGui" -I"C:\Program Files\msvc2017_64\include\QtANGLE" -I"C:\Program Files\msvc2017_64\include\QtSerialPort" -I"C:\Program Files\msvc2017_64\include\QtNetwork" -I"C:\Program Files\msvc2017_64\include\QtCore" -Idebug -I. -I\include -I"C:\Program Files\msvc2017_64\mkspecs\win32-msvc" -Fodebug\ @C:\Users\21443\AppData\Local\Temp\moc_widget.obj.4208.390.jom moc_widget.cpp upgrade_protocol.cpp(141): warning C4267: “初始化”: 从“size_t”转换到“uint16_t”,可能丢失数据 upgrade_protocol.cpp(180): warning C4189: “dataLength”: 局部变量已初始化但不引用 link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\ClientPro.exe @C:\Users\21443\AppData\Local\Temp\ClientPro.exe.4208.1453.jom upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm3_digest,函数 "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __cdecl UpgradeProtocol::sm3Hash(class std::vector<unsigned char,class std::allocator<unsigned char> > const &)" (?sm3Hash@UpgradeProtocol@@AEAA?AV?$vector@EV?$allocator@E@std@@@std@@AEBV23@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm2_point_from_octets,函数 "private: struct SM2_KEY __cdecl UpgradeProtocol::loadSM2PublicKeyFromData(class std::vector<unsigned char,class std::allocator<unsigned char> > const &)" (?loadSM2PublicKeyFromData@UpgradeProtocol@@AEAA?AUSM2_KEY@@AEBV?$vector@EV?$allocator@E@std@@@std@@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm2_key_generate,函数 "private: void __cdecl UpgradeProtocol::generateAndSaveSM2PrivateKey(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?generateAndSaveSM2PrivateKey@UpgradeProtocol@@AEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm2_key_set_public_key,函数 "private: struct SM2_KEY __cdecl UpgradeProtocol::loadSM2PublicKeyFromData(class std::vector<unsigned char,class std::allocator<unsigned char> > const &)" (?loadSM2PublicKeyFromData@UpgradeProtocol@@AEAA?AUSM2_KEY@@AEBV?$vector@EV?$allocator@E@std@@@std@@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm2_private_key_to_pem,函数 "private: void __cdecl UpgradeProtocol::generateAndSaveSM2PrivateKey(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?generateAndSaveSM2PrivateKey@UpgradeProtocol@@AEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm2_private_key_from_pem,函数 "private: struct SM2_KEY __cdecl UpgradeProtocol::loadSM2PrivateKey(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?loadSM2PrivateKey@UpgradeProtocol@@AEAA?AUSM2_KEY@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm2_encrypt,函数 "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __cdecl UpgradeProtocol::sm2Encrypt(struct SM2_KEY const &)" (?sm2Encrypt@UpgradeProtocol@@AEAA?AV?$vector@EV?$allocator@E@std@@@std@@AEBUSM2_KEY@@@Z) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm4_set_encrypt_key,函数 "private: void __cdecl UpgradeProtocol::generateSM4Key(void)" (?generateSM4Key@UpgradeProtocol@@AEAAXXZ) 中引用了该符号 upgrade_protocol.obj : error LNK2019: 无法解析的外部符号 sm4_cbc_encrypt,函数 "private: class std::vector<unsigned char,class std::allocator<unsigned char> > __cdecl UpgradeProtocol::sm4Encrypt(class std::vector<unsigned char,class std::allocator<unsigned char> > const &,class std::vector<unsigned char,class std::allocator<unsigned char> > &)" (?sm4Encrypt@UpgradeProtocol@@AEAA?AV?$vector@EV?$allocator@E@std@@@std@@AEBV23@AEAV23@@Z) 中引用了该符号 debug\ClientPro.exe : fatal error LNK1120: 9 个无法解析的外部命令 jom: D:\qtPro\ClientPro\Makefile.Debug [debug\ClientPro.exe] Error 1120 jom: D:\qtPro\ClientPro\Makefile [debug] Error 2 10:04:43: 进程"D:\qt\Tools\QtCreator\bin\jom\jom.exe"退出,退出代码 2 。 Error while building/deploying project ClientPro (kit: Replacement for "Desktop Qt 5.11.1 MSVC2017 64bit") When executing step "Make" 10:04:43: Elapsed time: 00:02.
-
@hhhl01 said in undefined reference to `sm3_digest':
else:unix:!macx: LIBS += -L$$PWD/../../GmSSL/gmssl.lib
On Unix/Linux this is wrong.
Please check https://doc.qt.io/qt-6/qmake-variable-reference.html#libs$$PWD/../../GmSSL/debug/gmssl.lib - is this path valid?
Are the missing functions part of the gmssl library? -
@hhhl01 said in undefined reference to `sm3_digest':
when I change it to the format below it doesn't work
I didn't say you have to change it for Windows.
Again: "Are the missing functions part of the gmssl library?"
Was this library built using same compiler? -
This post is deleted!