X509_NAME 与WinCrypt冲突

来源:互联网 发布:网易闪电邮网络超时 编辑:程序博客网 时间:2024/06/05 07:05

转载:http://blog.csdn.net/liuyu60305002/article/details/7742897


在Windows环境中使用 X509_NAME时,会因为include的顺序导致冲突。

如先

#include "openssl/x509.h" 

#include "windows.h"


X509_NAME *Name = X509_get_subject_name(p); //就会发生冲突 ,在windows中定义为 #define X509_NAME                           ((LPCSTR) 7)   跟openssl的不一致。

因此需要调换#include 的顺序,用openssl/x509.h 覆盖wincrypt.h中的X509_NAME。

#include "windows.h"

...

#include "openssl/x509.h"


另外在类里面,如果只导入 #include "openssl/x509.h" ,会出现 ”未定义的标识符“,也需要#include ”windows.h"。 此时才顺利编译成功。



0 0
原创粉丝点击