Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Crypt C function under Qt's MinGW not found
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,
Do you want to tell us:
- what platform you are on?
- what you mean by "doesn't include the crypt function" --- there is no
#includefor 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!)?
@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 ?
I can't say whether France is "trusted" enough by USA for
I don't know whether MinGW is supposed to supply you with a
crypt.hunder Windows (or anywhere for that matter, under Linux it comes with the OS). Does your MinGW contain a
crypt.hfile 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.
@JonB thanks for your reply,
There is no
crypt.hanywhere in the Qt's MinGW. But paradoxically, I have downloaded MinGW apart from Qt and there I can find the
I can include "windows.h" and "wincrypt.h" but I don't find the crypt function in them.
@Mixlu My guess is that Qt Company removes crypt.h from its MinGW distribution simply to avoid problems because of restrictions around exporting cryptography.
Yes it seems, might it be possible to add it as an external library ?
There are two possible issues.
crypt.his only a
#includeheader 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.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