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. Qkeychain - error: undefined reference to `__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject'
Forum Updated to NodeBB v4.3 + New Features

Qkeychain - error: undefined reference to `__imp__ZN9QKeychain16WritePasswordJobC1ERK7QStringP7QObject'

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 589 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
    dounreay
    wrote on last edited by dounreay
    #1

    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 += widgets

    CONFIG += c++11

    SOURCES +=
    main.cpp
    mainwindow.cpp
    settings.cpp
    sshsession.cpp

    HEADERS +=
    mainwindow.h
    settings.h
    sshsession.h

    FORMS +=
    mainwindow.ui
    settings.ui

    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target

    RESOURCES +=
    resourses.qrc

    win32: 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/include

    win32: 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/include

    win32: 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/include

    unix|win32: LIBS += -L$$PWD/../../../../src/vcpkg/installed/x64-windows/lib/ -
    lqt5keychain

    INCLUDEPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain
    DEPENDPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain

    jsulmJ 1 Reply Last reply
    0
    • D dounreay

      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 += widgets

      CONFIG += c++11

      SOURCES +=
      main.cpp
      mainwindow.cpp
      settings.cpp
      sshsession.cpp

      HEADERS +=
      mainwindow.h
      settings.h
      sshsession.h

      FORMS +=
      mainwindow.ui
      settings.ui

      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target

      RESOURCES +=
      resourses.qrc

      win32: 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/include

      win32: 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/include

      win32: 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/include

      unix|win32: LIBS += -L$$PWD/../../../../src/vcpkg/installed/x64-windows/lib/ -
      lqt5keychain

      INCLUDEPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain
      DEPENDPATH += $$PWD/../../../../src/vcpkg/installed/x64-windows/include/qt5keychain

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

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

        @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.

        jsulmJ 1 Reply Last reply
        0
        • D Offline
          D Offline
          dounreay
          wrote on last edited by
          #4

          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 function Settings::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.

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

            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.

            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
            0
            • D dounreay

              @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.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

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