mazix
mazix

Reputation: 2604

Compile Openssl with MinGW on Windows - fatal error: openssl/md4.h: No such file or directory

I did:

  1. Installed MinGW+MSYS
  2. Installed ActivePerl
  3. Added all I need to the PATH
  4. Downloaded latest Openssl and unzipped it into C:\openssl
  5. Did in my cmd.exe: perl Configure mingw shared --prefix=/c/openssl
  6. make depand
  7. make
  8. make install
  9. cded to C:\cpp where I have my test.cpp :

test.cpp:

#include <stdio.h>
#include <string.h>
#include <openssl/md4.h>

int main()
{
    unsigned char digest[MD4_DIGEST_LENGTH];
    char string[] = "hello world";

    MD4((unsigned char*)&string, strlen(string), (unsigned char*)&digest);    

    char mdString[33];

    for(int i = 0; i < MD4_DIGEST_LENGTH; i++)
         sprintf(&mdString[i*2], "%02x", (unsigned int)digest[i]);

    printf("md4 digest: %s\n", mdString);

    return 0;
}

Tried to compile it and got this:

C:\cpp>g++ test.cpp -lcrypto
test.cpp:3:25: fatal error: openssl/md4.h: No such file or directory
compilation terminated.

What should I do now?

Upvotes: 3

Views: 4207

Answers (1)

ouah
ouah

Reputation: 145899

Find the directory where the included file, openssl/md4.h, is installed and include that directory in the command.

For example, if the full path of openssl/md4.h is c:\openssl\include\openssl\md4.h, your command would become:

g++ -Ic:\openssl\include tst.cpp -lcrypto

Upvotes: 3

Related Questions