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 30 Apr 2020, 07:14 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.

    J 1 Reply Last reply 30 Apr 2020, 08:33
    0
    • M Mixlu
      30 Apr 2020, 07:14

      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.

      J Offline
      J Offline
      JonB
      wrote on 30 Apr 2020, 08:33 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 30 Apr 2020, 10:02 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 ?
        J 1 Reply Last reply 30 Apr 2020, 10:14
        0
        • M Mixlu
          30 Apr 2020, 10:02

          @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 ?
          J Offline
          J Offline
          JonB
          wrote on 30 Apr 2020, 10:14 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 30 Apr 2020, 10:31
          0
          • J JonB
            30 Apr 2020, 10:14

            @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 30 Apr 2020, 10:31 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.

            J 1 Reply Last reply 30 Apr 2020, 14:31
            0
            • M Mixlu
              30 Apr 2020, 10:31

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

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 30 Apr 2020, 14:31 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 30 Apr 2020, 15:48
              1
              • J jsulm
                30 Apr 2020, 14:31

                @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 30 Apr 2020, 15:48 last edited by
                #7

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

                J 1 Reply Last reply 30 Apr 2020, 16:01
                0
                • M Mixlu
                  30 Apr 2020, 15:48

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

                  J Offline
                  J Offline
                  JonB
                  wrote on 30 Apr 2020, 16:01 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

                  8/8

                  30 Apr 2020, 16:01

                  • Login

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