Important: Please read the Qt Code of Conduct -

libssh2 and QT

  • Good day Guys,

    Please help, I have tried everything with no joy.
    If i add the libssh2 library in my program i get the following error when i try and use a libssh2 variable.
    error: undefined reference to `_RTC_CheckEsp'
    I get 369 of these erorrs.0_1540395635854_profile.PNG 0_1540395645441_errors.PNG

    I am new in qt please give detailed instructions on how to resolve if you have a solution.
    OS: Windows 10 64 bit
    Qt 5.11.2

  • @zemcos
    This looks as though it might be to do with a mix up over C runtime libraries and debug/release versions.

    First things first: since you added "the libssh2 library in my program", have you cleaned out completely any builds you did previously, and made everything rebuild from scratch?

    Otherwise: it might help if you said whether you are trying/intending to build for Release or Debug?

    And btw, you are indeed using gcc/MinGW as your compiler, not MSVC. Right?

  • @JonB

    Good day,

    Thanks for the reply

    i am using mingw 32bit and building for Release.
    I have cleaned the builds over and over but get the same error.

  • @zemcos
    I must warn you: I don't use C, Windows, .pro/cmake files etc. So you won't get any examples from me, I can only point you where I would look.

    You say this only happens when you link with libssh2. I suspect that _RTC_CheckEsp would be a debug-only function. That would indicate that the library files being linked are somehow compiled for debug rather than release themselves. (If it's easy for you to do, you might check whether the errors go away if you do compile for debug.) Make sure it's using the appropriate link line from the conditional lines in the .pro file you show, and that the right file there is being used. BTW, when you added libssh2 to your project, did you not also have to add any further libraries for it?

  • i cmake built the libraries which required libs from openssl but didn't add any into my project

  • @zemcos same warning as @JonB did, not that I use Windows that much.
    Searching for unresolved external symbol __RTC_CheckEsp I found several entries, like this one so it seems like a specific MSVC thing.

    So given that condition, could it be possible that you're building the library with MinGW but using MSCV switches instead?

  • Good day Pablo,

    You are right, what is recommended for building binaries for libssh2?

  • Lifetime Qt Champion

    @zemcos said in libssh2 and QT:

    You are right, what is recommended for building binaries for libssh2?

    Use same compiler you use for your app

  • @zemcos
    If you are saying you compiled the ssh libraries, why would you not use the same compiler as you do for your program? Anyway, it is vitally important that you use the same compiler and similar/compatible compiler options for any libraries you want to link against your app. You cannot use libraries compiled with one complier/set of switches against an application compiled with a different compiler/set of switches.

  • @zemcos said in libssh2 and QT:

    what is recommended for building binaries for libssh2?

    I'm afraid I cannot help you here directly, but let me ask you how did you build the library yourself? Could you please provide the full command line/switches/etc you have used?

    As mentioned before, it's very important that you use the same compiler to build both the supporting libraries and your application.

    Looking briefly at libssh2 code, it has support for building it with CMake or autotools so you have choices to pick from.

    In addition, building this library could be considered out of scope for Qt itself...

Log in to reply