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. Integration of libssh into a Qt project
QtWS25 Last Chance

Integration of libssh into a Qt project

Scheduled Pinned Locked Moved Unsolved General and Desktop
libssh
5 Posts 2 Posters 6.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.
  • WotanW Offline
    WotanW Offline
    Wotan
    wrote on last edited by
    #1

    I am doing an application to communicate with an embedded software thanks to the libssh tools.
    But every time I call the lib, I have got a crash of my application. I finally decided to simplify my project at the maximum to see what is the problem by doing a simple console project but it is still crashing. So I finally come to you to see if anyone of you have an idea.

    My OS is Windows 7 Professional
    I am developing with QtCreator 3.2.1
    My Qt Version is Qt 5.3.2

    Here is my .pro file:

    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt
    
    SOURCES += main.cpp
    
    include(deployment.pri)
    qtcAddDeployment()
    
    LIBS += -L$$PWD/LibSSH/lib -lssh.dll
    
    

    And here is my main.cpp

    #include <iostream>
    #include "LibSSH/include/libssh/libssh.h"
    
    using namespace std;
    
    int main()
    {
       ssh_session my_ssh_session = ssh_new();
       if (my_ssh_session == NULL)
         exit(-1);
    
       ssh_free(my_ssh_session);
    
       cout << "Hello World!" << endl;
       return 0;
    }
    
    

    As you can see, every time I call ssh_new() there is a crash, my console answer me :

    Démarrage de I:\Projets\Test_libssh\release\Test_libssh.exe...
    I:\Projets\Test_libssh\release\Test_libssh.exe s'est terminé avec le code -1073741515
    

    Thanks for your time

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Did you debug step by step to see in which line it crashes?

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

      1 Reply Last reply
      0
      • WotanW Offline
        WotanW Offline
        Wotan
        wrote on last edited by
        #3

        I tried to debug it step by step but it is impossible because it crashed before the first line.
        I have made a discovery, it is a problem of link with the dll. I made a comparison with another project which work. In the release repertory right aside the .exe file I found the following .dll :

        libeay32.dll
        libssh.dll
        libssh_threads.dll
        

        I took those dll and copy them in my release repertory and now it worked.
        I thought that the link was made with the file in the LibSSH directory but apparently it is not enough. I don't understand where I was supposed to find these dlls (I confess that I am not very used with the dlls)
        I am glad that I found the solution and very thankful for the time you spare to me.
        Now I still liked to know what was my mistake when I took the library libssh.

        Thanks to you all !

        1 Reply Last reply
        0
        • jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Well, the system is looking for libraries in specific locations like c:\windows and in the same directory where the exe is located. That's why it didn't find the DLLs.

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

          1 Reply Last reply
          0
          • WotanW Offline
            WotanW Offline
            Wotan
            wrote on last edited by
            #5

            How do we mark a subject as solved ?

            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