Crypt C function under Qt's MinGW not found
-
-
@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!)?
-
@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 ?
-
@Mixlu
I can't say whether France is "trusted" enough by USA forcrypt
;-)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 acrypt.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.
-
@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 thecrypt.h
.I can include "windows.h" and "wincrypt.h" but I don't find the crypt function in them.
-
@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 aboutlibcrypt.a
,libcrypt.so
and/orlibcrypt.dll
. (For MinGW I also see mentions oflibgcrypt
, 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