Fatal error: mcrypt.h: No such file or directory

Hi All,

I am trying to include a mcrypt.h header but I am getting the below error:

test01> gcc test1.c

test1.c:5:20: fatal error: mcrypt.h: No such file or directory
 #include <mcrypt.h>
                    ^
compilation terminated.

As I cannot put my encryption program here, so have put a sample code which I ran :

/* Hello World program */

#include<stdio.h>

#include <mcrypt.h>


main()
{
    printf("Hello World");

}

libmcrypt is installed as below in UNIX

lrwxrwxrwx    1 root     system           43 14 Jul 16:29 libmcrypt.so.4.4.8 -> ../../opt/freeware/lib64/libmcrypt.so.4.4.8

lrwxrwxrwx    1 root     system           39 14 Jul 16:29 libmcrypt.so.4 -> ../../opt/freeware/lib64/libmcrypt.so.4

lrwxrwxrwx    1 root     system           37 14 Jul 16:29 libmcrypt.so -> ../../opt/freeware/lib64/libmcrypt.so

lrwxrwxrwx    1 root     system           34 14 Jul 16:29 libmcrypt -> ../../opt/freeware/lib64/libmcrypt

Thanks in ADVANCE.

You will have to install the package libmcrypt-dev as it provides mcrypt.h .

1 Like

Hi Zaxxon,

Thank you for your reply.

But as I have mentioned, libmcrypt is already installed :

lrwxrwxrwx    1 root     system           43 14 Jul 16:29 libmcrypt.so.4.4.8 -> ../../opt/freeware/lib64/libmcrypt.so.4.4.8

lrwxrwxrwx    1 root     system           39 14 Jul 16:29 libmcrypt.so.4 -> ../../opt/freeware/lib64/libmcrypt.so.4

lrwxrwxrwx    1 root     system           37 14 Jul 16:29 libmcrypt.so -> ../../opt/freeware/lib64/libmcrypt.so

lrwxrwxrwx    1 root     system           34 14 Jul 16:29 libmcrypt -> ../../opt/freeware/lib64/libmcrypt

Let me know if I am wrong, as I am new bee in C programming.

Thanks.

*shrug* All right, you're wrong. :slight_smile: You need to install libmcrypt-dev, too.

Most binary distributions split packages into two parts, those needed to compile with them, and those needed to just use them. I consider this a bad habit inherited from the 90's when hard drive space was at a premium, not really necessary now in most situations.

1 Like

Thanks Zaxxon and Corona688. It worked.:slight_smile:

1 Like