'HCRYPTHASH' : undeclared identifier 类似错误的解决办法
来源:互联网 发布:linux mkdir命令用法 编辑:程序博客网 时间:2024/05/04 16:42
在编译一个cpp程序时,明明已经 include <wincrypt.h>,可还是报错
D:\crypt\crypt.cpp(20) : error C2065: 'HCRYPTHASH' : undeclared identifier
D:\crypt\crypt.cpp(20) : error C2146: syntax error : missing ';' before identifier 'hHash'
D:\crypt\crypt.cpp(20) : error C2065: 'hHash' : undeclared identifier
D:\crypt\crypt.cpp(22) : error C2065: 'HCRYPTKEY' : undeclared identifier
D:\crypt\crypt.cpp(22) : error C2146: syntax error : missing ';' before identifier 'hKey'
D:\crypt\crypt.cpp(22) : error C2065: 'hKey' : undeclared identifier
D:\crypt\crypt.cpp(24) : error C2065: 'HCRYPTPROV' : undeclared identifier
D:\crypt\crypt.cpp(24) : error C2146: syntax error : missing ';' before identifier 'hProv'
D:\crypt\crypt.cpp(24) : error C2065: 'hProv' : undeclared identifier
D:\crypt\crypt.cpp(32) : error C2065: 'CryptAcquireContext' : undeclared identifier
D:\crypt\crypt.cpp(38) : error C2065: 'CryptCreateHash' : undeclared identifier
D:\crypt\crypt.cpp(54) : error C2065: 'CryptHashData' : undeclared identifier
D:\crypt\crypt.cpp(70) : error C2065: 'CryptDeriveKey' : undeclared identifier
D:\crypt\crypt.cpp(105) : error C2065: 'CryptEncrypt' : undeclared identifier
D:\crypt\crypt.cpp(151) : error C2065: 'CryptDestroyHash' : undeclared identifier
D:\crypt\crypt.cpp(157) : error C2065: 'CryptDestroyKey' : undeclared identifier
原因是:
vc6缺省是不定义_WIN32_WINNT宏的。
而在wincrypt.h中有
#if (_WIN32_WINNT >= 0x0400)
...
#endif
解决办法是:
在stdafx.h中添加
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
D:\crypt\crypt.cpp(20) : error C2065: 'HCRYPTHASH' : undeclared identifier
D:\crypt\crypt.cpp(20) : error C2146: syntax error : missing ';' before identifier 'hHash'
D:\crypt\crypt.cpp(20) : error C2065: 'hHash' : undeclared identifier
D:\crypt\crypt.cpp(22) : error C2065: 'HCRYPTKEY' : undeclared identifier
D:\crypt\crypt.cpp(22) : error C2146: syntax error : missing ';' before identifier 'hKey'
D:\crypt\crypt.cpp(22) : error C2065: 'hKey' : undeclared identifier
D:\crypt\crypt.cpp(24) : error C2065: 'HCRYPTPROV' : undeclared identifier
D:\crypt\crypt.cpp(24) : error C2146: syntax error : missing ';' before identifier 'hProv'
D:\crypt\crypt.cpp(24) : error C2065: 'hProv' : undeclared identifier
D:\crypt\crypt.cpp(32) : error C2065: 'CryptAcquireContext' : undeclared identifier
D:\crypt\crypt.cpp(38) : error C2065: 'CryptCreateHash' : undeclared identifier
D:\crypt\crypt.cpp(54) : error C2065: 'CryptHashData' : undeclared identifier
D:\crypt\crypt.cpp(70) : error C2065: 'CryptDeriveKey' : undeclared identifier
D:\crypt\crypt.cpp(105) : error C2065: 'CryptEncrypt' : undeclared identifier
D:\crypt\crypt.cpp(151) : error C2065: 'CryptDestroyHash' : undeclared identifier
D:\crypt\crypt.cpp(157) : error C2065: 'CryptDestroyKey' : undeclared identifier
原因是:
vc6缺省是不定义_WIN32_WINNT宏的。
而在wincrypt.h中有
#if (_WIN32_WINNT >= 0x0400)
...
#endif
解决办法是:
在stdafx.h中添加
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
0 0
- 'HCRYPTHASH' : undeclared identifier 类似错误的解决办法
- LWA_COLORKEY undeclared identifier 的解决办法
- winpcap各种undeclared identifier的解决办法
- error C2065: '_beginthreadex' : undeclared identifier 的解决办法
- error C2065: 'PMIB_IPSTATS' : undeclared identifier的解决办法
- _beginthreadex : undeclared identifier解决办法
- _beginthreadex : undeclared identifier解决办法
- _beginthreadex : undeclared identifier解决办法
- _beginthreadex : undeclared identifier解决办法
- Undeclared Identifier错误解决方法
- VS2008下编译错误(error C2065: '_S1max' : undeclared identifier)的解决办法
- 问题 error C2065: '_beginthreadex' : undeclared identifier 的解决办法
- 问题 error C2065: '_beginthreadex' : undeclared identifier 的解决办法
- 加string.h后出现string' : undeclared identifier的解决办法
- 'IplImage' : undeclared identifier错误解决
- 【编译错误】_beginthreadx :undeclared identifier
- error C2065: 'CString' : undeclared identifier错误的处理方法
- 结构体中经常碰到的一个错误 undeclared identifier
- 二分(折半)查找算法实现
- 最正确的学习方法,程序员如何学习一项你之前完全不了解的新技术?
- VC6里的_WIN32_WINNT宏
- Ubuntu 下 触摸板不能使用 解决方法
- android学习笔记(九)——动画效果的实现逐帧动画
- 'HCRYPTHASH' : undeclared identifier 类似错误的解决办法
- 百度云消息推送机制简介及开发前的集成,入门篇
- 数组中两两相加等于20的组合种数
- bzoj2989&4170: 数列
- 说说Git的ssh key
- 文本文件和二进制文件的区别
- C语言-共用体
- 使用Docker部署Gitlab
- 【零基础】CentOS 7 64位系统下编译Hadoop2.7.0