Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. how to integrate libssh with windows QT Creator 11.0.2

how to integrate libssh with windows QT Creator 11.0.2

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
6 Posts 2 Posters 1.1k Views
  • 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.
  • S Offline
    S Offline
    solo_engineer
    wrote on last edited by
    #1

    I need to make an application that runs in Raspberrypi where I can transfer files using ssh from the host Windows machine to the remote pi. and also execute a few read-a-file commands there.
    Hence I have to use these lines
    "#include <libssh/libssh.h>"

    i did installed the libssh using vcpkg. please find the logs " .\vcpkg list
    libssh:x64-windows 0.10.5 libssh is a multiplatform C library implementing...
    libssh:x86-windows 0.10.5 libssh is a multiplatform C library implementing...
    libssh[crypto]:x64-windows Default crypto backend
    libssh[crypto]:x86-windows Default crypto backend
    libssh[mbedtls]:x64-windows Crypto support (mbedTLS)
    libssh[mbedtls]:x86-windows Crypto support (mbedTLS)
    mbedtls:x64-windows 2.28.1 An open source, portable, easy to use, readable ...
    mbedtls:x86-windows 2.28.1 An open source, portable, easy to use, readable ...
    mbedtls[pthreads]:x64-windows Multi-threading support
    mbedtls[pthreads]:x86-windows Multi-threading support
    pthreads:x64-windows 3.0.0#14 Meta-package that provides PThreads4W on Windows...
    pthreads:x86-windows 3.0.0#14 Meta-package that provides PThreads4W on Windows...
    vcpkg-cmake-config:x64-windows 2022-02-06#1
    vcpkg-cmake:x64-windows 2023-05-04"

    yet eventhough i am able to incude the libssh files into .pro fiel like this
    INCLUDEPATH += C:/Users/****/vcpkg/installed/x64-windows/include
    LIBS += -LC:C:/Users/*****/vcpkg/installed/x64-windows/lib

    i cant build the libssh.h included files. please fine a sample function to connect SSHManager::SSHManager() : sshSession(nullptr) {
    sshSession = ssh_new();
    }

    SSHManager::~SSHManager() {
    if (sshSession) {
    ssh_disconnect(sshSession);
    ssh_free(sshSession);
    }
    }

    it throws the below linker error "sshmanager.obj:-1: error: LNK2019: unresolved external symbol __imp_ssh_new referenced in function "public: __cdecl SSHManager::SSHManager(void)" (??0SSHManager@@QEAA@XZ)"

    please help with how to integrate the libssh into QT?

    jsulmJ 1 Reply Last reply
    0
    • S solo_engineer

      I need to make an application that runs in Raspberrypi where I can transfer files using ssh from the host Windows machine to the remote pi. and also execute a few read-a-file commands there.
      Hence I have to use these lines
      "#include <libssh/libssh.h>"

      i did installed the libssh using vcpkg. please find the logs " .\vcpkg list
      libssh:x64-windows 0.10.5 libssh is a multiplatform C library implementing...
      libssh:x86-windows 0.10.5 libssh is a multiplatform C library implementing...
      libssh[crypto]:x64-windows Default crypto backend
      libssh[crypto]:x86-windows Default crypto backend
      libssh[mbedtls]:x64-windows Crypto support (mbedTLS)
      libssh[mbedtls]:x86-windows Crypto support (mbedTLS)
      mbedtls:x64-windows 2.28.1 An open source, portable, easy to use, readable ...
      mbedtls:x86-windows 2.28.1 An open source, portable, easy to use, readable ...
      mbedtls[pthreads]:x64-windows Multi-threading support
      mbedtls[pthreads]:x86-windows Multi-threading support
      pthreads:x64-windows 3.0.0#14 Meta-package that provides PThreads4W on Windows...
      pthreads:x86-windows 3.0.0#14 Meta-package that provides PThreads4W on Windows...
      vcpkg-cmake-config:x64-windows 2022-02-06#1
      vcpkg-cmake:x64-windows 2023-05-04"

      yet eventhough i am able to incude the libssh files into .pro fiel like this
      INCLUDEPATH += C:/Users/****/vcpkg/installed/x64-windows/include
      LIBS += -LC:C:/Users/*****/vcpkg/installed/x64-windows/lib

      i cant build the libssh.h included files. please fine a sample function to connect SSHManager::SSHManager() : sshSession(nullptr) {
      sshSession = ssh_new();
      }

      SSHManager::~SSHManager() {
      if (sshSession) {
      ssh_disconnect(sshSession);
      ssh_free(sshSession);
      }
      }

      it throws the below linker error "sshmanager.obj:-1: error: LNK2019: unresolved external symbol __imp_ssh_new referenced in function "public: __cdecl SSHManager::SSHManager(void)" (??0SSHManager@@QEAA@XZ)"

      please help with how to integrate the libssh into QT?

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

      @solo_engineer said in how to integrate libssh with windows QT Creator 11.0.2:

      LIBS += -LC:C:/Users/*****/vcpkg/installed/x64-windows/lib

      This is wrong.
      First: one "C:" not two of them.
      Second: you also need to specify the lib to link, not just the folder where the lib is.
      On Windows you need to use the *.lib file with -l:

      LIBS += -lC:/Users/*****/vcpkg/installed/x64-windows/lib/LIB_TO_LINK.lib
      

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        solo_engineer
        wrote on last edited by
        #3

        Gratitude for the reply.
        I changed the .pro file the same.
        and now I could build the functions to connect and disconnect like this "SSHManager::SSHManager() : sshSession(nullptr) {
        sshSession = ssh_new();
        }

        SSHManager::~SSHManager() {
        if (sshSession) {
        ssh_disconnect(sshSession);
        ssh_free(sshSession);
        }
        } "

        Yet I am unable to create the release version of the app.
        It throws an error like this "The code execution cannot proceed because ssh.dll was not fouynd. reinstalling the program mag fix this problem"
        Also this is the QT.pro file
        "CONFIG += c++17

        INCLUDEPATH += "C:/Users/***/vcpkg/installed/x64-windows/include"
        #LIBS += -L"C:/Users//vcpkg/installed/x64-windows/lib" -lssh
        LIBS += -lC:/Users/
        /vcpkg/installed/x64-windows/lib/ssh.lib"

        Also the contents of the echo $PATH command in my system:
        C:\Program Files (x86)\VMware\VMware Player\bin;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\PuTTY;C:\MinGW\bin;C;C:\Program Files\Graphviz\bin;C:\Program Files\Microchip\xc8\v2.41\bin;C:\Users*\vcpkg\installed\x64-windows\bin\ssh.dll;C:\Users**\AppData\Local\Microsoft\WindowsApps;

        please do let me how to create the release version of the app with libssh.

        S 1 Reply Last reply
        0
        • S solo_engineer

          Gratitude for the reply.
          I changed the .pro file the same.
          and now I could build the functions to connect and disconnect like this "SSHManager::SSHManager() : sshSession(nullptr) {
          sshSession = ssh_new();
          }

          SSHManager::~SSHManager() {
          if (sshSession) {
          ssh_disconnect(sshSession);
          ssh_free(sshSession);
          }
          } "

          Yet I am unable to create the release version of the app.
          It throws an error like this "The code execution cannot proceed because ssh.dll was not fouynd. reinstalling the program mag fix this problem"
          Also this is the QT.pro file
          "CONFIG += c++17

          INCLUDEPATH += "C:/Users/***/vcpkg/installed/x64-windows/include"
          #LIBS += -L"C:/Users//vcpkg/installed/x64-windows/lib" -lssh
          LIBS += -lC:/Users/
          /vcpkg/installed/x64-windows/lib/ssh.lib"

          Also the contents of the echo $PATH command in my system:
          C:\Program Files (x86)\VMware\VMware Player\bin;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\PuTTY;C:\MinGW\bin;C;C:\Program Files\Graphviz\bin;C:\Program Files\Microchip\xc8\v2.41\bin;C:\Users*\vcpkg\installed\x64-windows\bin\ssh.dll;C:\Users**\AppData\Local\Microsoft\WindowsApps;

          please do let me how to create the release version of the app with libssh.

          S Offline
          S Offline
          solo_engineer
          wrote on last edited by solo_engineer
          #4

          @solo_engineer
          PFB the path command output
          "echo %PATH%
          C:\Program Files (x86)\VMware\VMware Player\bin;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\PuTTY;C:\MinGW\bin;C;C:\Program Files\Graphviz\bin;C:\Program Files\Microchip\xc8\v2.41\bin;C:\Users*\vcpkg\installed\x64-windows\bin\ssh.dll;C:\Users*\AppData\Local\Microsoft\WindowsApps;C:\Users*\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users*\AppData\Local\Programs\Git\cmd;C:\Users**\AppData\Local\GitHubDesktop\bin""

          jsulmJ 1 Reply Last reply
          0
          • S solo_engineer

            @solo_engineer
            PFB the path command output
            "echo %PATH%
            C:\Program Files (x86)\VMware\VMware Player\bin;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\PuTTY;C:\MinGW\bin;C;C:\Program Files\Graphviz\bin;C:\Program Files\Microchip\xc8\v2.41\bin;C:\Users*\vcpkg\installed\x64-windows\bin\ssh.dll;C:\Users*\AppData\Local\Microsoft\WindowsApps;C:\Users*\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users*\AppData\Local\Programs\Git\cmd;C:\Users**\AppData\Local\GitHubDesktop\bin""

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

            @solo_engineer To execute your app you need the dll version of the lib. You can put it next to the app executable.

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

            S 1 Reply Last reply
            2
            • jsulmJ jsulm

              @solo_engineer To execute your app you need the dll version of the lib. You can put it next to the app executable.

              S Offline
              S Offline
              solo_engineer
              wrote on last edited by
              #6

              @jsulm Thanks for the solution.

              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