我做了:
cmd.exe
:perl配置mingw共享--prefix = / c / openssl make depand
make
make install
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;
}
试图编译它并得到了这个:
C:\cpp>g++ test.cpp -lcrypto
test.cpp:3:25: fatal error: openssl/md4.h: No such file or directory
compilation terminated.
我现在该怎么办?
答案 0 :(得分:3)
找到安装包含文件openssl/md4.h
的目录,并在命令中包含该目录。
例如,如果openssl/md4.h
的完整路径为c:\openssl\include\openssl\md4.h
,则您的命令将变为:
g++ -Ic:\openssl\include tst.cpp -lcrypto