Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Crypt C function under Qt's MinGW not found
QtWS25 Last Chance

Crypt C function under Qt's MinGW not found

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
mingw
8 Posts 3 Posters 2.0k 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.
  • M Offline
    M Offline
    Mixlu
    wrote on last edited by
    #1

    Hi,

    I am working on a Qt 5.13 project under MinGW 8.1.0 64-bit and need to use the crypt C function from glibc. But it seems that the MinGW version of Qt doesn't include the crypt function, why ?
    Is there any way to use it ?

    Thanks for any help,
    Mathis.

    JonBJ 1 Reply Last reply
    0
    • M Mixlu

      Hi,

      I am working on a Qt 5.13 project under MinGW 8.1.0 64-bit and need to use the crypt C function from glibc. But it seems that the MinGW version of Qt doesn't include the crypt function, why ?
      Is there any way to use it ?

      Thanks for any help,
      Mathis.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Mixlu
      Do you want to tell us:

      • what platform you are on?
      • what you mean by "doesn't include the crypt function" --- there is no #include for you to use and you get a compile-time error, or it compiles but you get a linker "unresolved reference", or it links and you get a run-time error/return result when you try to call it?
      • whether you (actually the OS/packages you installed) are in the USA or not (yes, this may well be relevant!)?
      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mixlu
        wrote on last edited by
        #3

        @JonB thanks for your reply,

        • I am under Windows 10
        • It means that when I try to include it as #include <crypt.h> I have a compile-time error : 'crypt.h' file not found.
        • Yes I have heard about some cryptographic functions restriction in the USA but I am in France so I guess it's ok ?
        JonBJ 1 Reply Last reply
        0
        • M Mixlu

          @JonB thanks for your reply,

          • I am under Windows 10
          • It means that when I try to include it as #include <crypt.h> I have a compile-time error : 'crypt.h' file not found.
          • Yes I have heard about some cryptographic functions restriction in the USA but I am in France so I guess it's ok ?
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @Mixlu
          I can't say whether France is "trusted" enough by USA for crypt ;-)

          I don't know whether MinGW is supposed to supply you with a crypt.h under Windows (or anywhere for that matter, under Linux it comes with the OS). Does your MinGW contain a crypt.h file at all anywhere? I see that https://stackoverflow.com/questions/28792711/can-i-include-crypt-h-in-c-on-windows for Visual C++ at least says you need to

          #include <windows.h>
          #include <wincrypt.h>
          

          Maybe you have to do for MinGW too?

          There is also https://stackoverflow.com/questions/47795455/adding-the-crypt-library-to-a-c-program-in-windows-10-cmd-prompt in a similar-ish vein.

          M 1 Reply Last reply
          0
          • JonBJ JonB

            @Mixlu
            I can't say whether France is "trusted" enough by USA for crypt ;-)

            I don't know whether MinGW is supposed to supply you with a crypt.h under Windows (or anywhere for that matter, under Linux it comes with the OS). Does your MinGW contain a crypt.h file at all anywhere? I see that https://stackoverflow.com/questions/28792711/can-i-include-crypt-h-in-c-on-windows for Visual C++ at least says you need to

            #include <windows.h>
            #include <wincrypt.h>
            

            Maybe you have to do for MinGW too?

            There is also https://stackoverflow.com/questions/47795455/adding-the-crypt-library-to-a-c-program-in-windows-10-cmd-prompt in a similar-ish vein.

            M Offline
            M Offline
            Mixlu
            wrote on last edited by
            #5

            @JonB thanks for your reply,

            There is no crypt.h anywhere in the Qt's MinGW. But paradoxically, I have downloaded MinGW apart from Qt and there I can find the crypt.h.

            I can include "windows.h" and "wincrypt.h" but I don't find the crypt function in them.

            jsulmJ 1 Reply Last reply
            0
            • M Mixlu

              @JonB thanks for your reply,

              There is no crypt.h anywhere in the Qt's MinGW. But paradoxically, I have downloaded MinGW apart from Qt and there I can find the crypt.h.

              I can include "windows.h" and "wincrypt.h" but I don't find the crypt function in them.

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

              @Mixlu My guess is that Qt Company removes crypt.h from its MinGW distribution simply to avoid problems because of restrictions around exporting cryptography.

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

              M 1 Reply Last reply
              1
              • jsulmJ jsulm

                @Mixlu My guess is that Qt Company removes crypt.h from its MinGW distribution simply to avoid problems because of restrictions around exporting cryptography.

                M Offline
                M Offline
                Mixlu
                wrote on last edited by
                #7

                @jsulm
                Yes it seems, might it be possible to add it as an external library ?

                JonBJ 1 Reply Last reply
                0
                • M Mixlu

                  @jsulm
                  Yes it seems, might it be possible to add it as an external library ?

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @Mixlu
                  There are two possible issues. crypt.h is only a #include header file, needed to compile. Separately is the library containing the crypt code, which you will need at link-time (else "unresolved reference error") and/or run-time. Depending on your platform, we might be talking about libcrypt.a, libcrypt.so and/or libcrypt.dll. (For MinGW I also see mentions of libgcrypt, I don't know if that is relevant to you.) You will need one of these too, unless the crypt code is already actually in some other supplied runtime library.

                  If you are Windows (you are, aren't you?) you might like to look at e.g. https://stackoverflow.com/questions/48410282/mingw32-compiler-giving-error-with-lcrypt

                  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