Qkeychain - error: undefined reference to `__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject'
-
I'm trying to store passwords in my QT project using Qkeychain. I've installed and imported the libraries, however I keep on getting "error: undefined reference to `__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject'" when I try to compile. I've included my .pro file. Any help would be really appreciated. Thanks
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgetsCONFIG += c++11
SOURCES +=
main.cpp
mainwindow.cpp
settings.cpp
sshsession.cppHEADERS +=
mainwindow.h
settings.h
sshsession.hFORMS +=
mainwindow.ui
settings.uiqnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += targetRESOURCES +=
resourses.qrcwin32: LIBS += -L$$PWD/../../../../src/vcpkg/installed/x64-windows/lib/ -llibssh2
INCLUDEPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include
DEPENDPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/includewin32: LIBS += -L$$PWD/../../../../src/vcpkg/installed/x64-windows/lib/ -llibssl
INCLUDEPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include
DEPENDPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/includewin32: LIBS += -L$$PWD/../../../../src/vcpkg/installed/x64-windows/lib/ -lssh
INCLUDEPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include
DEPENDPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/includeunix|win32: LIBS += -L$$PWD/../../../../src/vcpkg/installed/x64-windows/lib/ -
lqt5keychainINCLUDEPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain
DEPENDPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain -
@dounreay Please post the whole error message and also the linker call which is causing it.
Does $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain contain the lib?
Was this lib build using same compiler as you're using? -
@jsulm said in Qkeychain - error: undefined reference to `__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject':
Was this lib build using same compiler as you're using?
No, the libraries and the includes are in different sub directories. I'll try moving it now
I'm not sure how to check what compiler was used for the lib, although I have installed other libraries successfully.
-
19:57:57: Running steps for project remote...
19:57:57: Configuration unchanged, skipping qmake step.
19:57:57: Starting: "C:\Qt\Tools\mingw900_64\bin\mingw32-make.exe" -j8
C:/Qt/Tools/mingw900_64/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/Public/Documents/build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug'
C:\Qt\6.2.2\mingw_64\bin\uic.exe ..\remote\mainwindow.ui -o ui_mainwindow.h
C:\Qt\6.2.2\mingw_64\bin\uic.exe ..\remote\settings.ui -o ui_settings.h
C:\Qt\6.2.2\mingw_64\bin\rcc.exe -name resourses ..\remote\resourses.qrc -o debug\qrc_resourses.cpp
g++ -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -dM -E -o debug\moc_predefs.h ........\Qt\6.2.2\mingw_64\mkspecs\features\data\dummy.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\main.o ..\remote\main.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\mainwindow.o ..\remote\mainwindow.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\settings.o ..\remote\settings.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\sshsession.o ..\remote\sshsession.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\qrc_resourses.o debug\qrc_resourses.cpp
C:\Qt\6.2.2\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include C:/Users/Public/Documents/build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.2.2/mingw_64/mkspecs/win32-g++ -IC:/Users/Public/Documents/remote -IC:/src/vcpkg/installed/x64-windows/include -IC:/src/vcpkg/installed/x64-windows/include -IC:/src/vcpkg/installed/x64-windows/include -IC:/src/vcpkg/installed/x64-windows/include -IC:/Qt/6.2.2/mingw_64/include -IC:/Qt/6.2.2/mingw_64/include/QtWidgets -IC:/Qt/6.2.2/mingw_64/include/QtGui -IC:/Qt/6.2.2/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw900_64/x86_64-w64-mingw32/include ..\remote\mainwindow.h -o debug\moc_mainwindow.cpp
C:\Qt\6.2.2\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include C:/Users/Public/Documents/build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.2.2/mingw_64/mkspecs/win32-g++ -IC:/Users/Public/Documents/remote -IC:/src/vcpkg/installed/x64-windows/include -IC:/src/vcpkg/installed/x64-windows/include -IC:/src/vcpkg/installed/x64-windows/include -IC:/src/vcpkg/installed/x64-windows/include -IC:/Qt/6.2.2/mingw_64/include -IC:/Qt/6.2.2/mingw_64/include/QtWidgets -IC:/Qt/6.2.2/mingw_64/include/QtGui -IC:/Qt/6.2.2/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw900_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw900_64/x86_64-w64-mingw32/include ..\remote\settings.h -o debug\moc_settings.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\moc_settings.o debug\moc_settings.cpp
g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../remote -I. -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../src/vcpkg/installed/x64-windows/include -I../../../../Qt/6.2.2/mingw_64/include -I../../../../Qt/6.2.2/mingw_64/include/QtWidgets -I../../../../Qt/6.2.2/mingw_64/include/QtGui -I../../../../Qt/6.2.2/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../../Qt/6.2.2/mingw_64/mkspecs/win32-g++ -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp
g++ -Wl,-subsystem,windows -mthreads -o debug\remote.exe debug/main.o debug/mainwindow.o debug/settings.o debug/sshsession.o debug/qrc_resourses.o debug/moc_mainwindow.o debug/moc_settings.o -LC:\src\vcpkg\installed\x64-windows\lib -llibssh2 -llibssl -lssh -lqt5keychain C:\Qt\6.2.2\mingw_64\lib\libQt6Widgets.a C:\Qt\6.2.2\mingw_64\lib\libQt6Gui.a C:\Qt\6.2.2\mingw_64\lib\libQt6Core.a -lmingw32 C:\Qt\6.2.2\mingw_64\lib\libQt6EntryPoint.a -lshell32
C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: debug/settings.o: in functionSettings::on_buttonBox_accepted()': C:\Users\Public\Documents\build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/../remote/settings.cpp:39: undefined reference to
__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject'
C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Public\Documents\build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/../remote/settings.cpp:57: undefined reference to__imp__ZN9QKeychain16WritePasswordJobD1Ev' C:/Qt/Tools/mingw900_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Public\Documents\build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/../remote/settings.cpp:57: undefined reference to
__imp__ZN9QKeychain16WritePasswordJobD1Ev'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: Leaving directory 'C:/Users/Public/Documents/build-remote-Desktop_Qt_6_2_2_MinGW_64_bit-Debug'
mingw32-make[1]: *** [Makefile.Debug:84: debug/remote.exe] Error 1
mingw32-make: *** [Makefile:45: debug] Error 2
19:58:15: The process "C:\Qt\Tools\mingw900_64\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project remote (kit: Desktop Qt 6.2.2 MinGW 64-bit)
When executing step "Make"
19:58:15: Elapsed time: 00:18. -
Are you sure that Qt5Keychain lib is compiled for MinGW and not MSVC?
vcpkg
in the directory name does not look like a MinGW build. -
@dounreay said in Qkeychain - error: undefined reference to `__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject':
No, the libraries and the includes are in different sub directories
This is not what I asked. And there is also no need to move the lib.
What I asked was: was this library built using same compiler or a different one? You can't mix binaries built with different compilers (like MSVC and MinGW) in same application.