'HCRYPTHASH' : undeclared identifier 类似错误的解决办法
2015-07-05 17:05
357 查看
在编译一个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
相关文章推荐
- android学习笔记(九)——动画效果的实现逐帧动画
- 数组中两两相加等于20的组合种数
- VC6里的_WIN32_WINNT宏
- 二分(折半)查找算法实现
- Ubuntu 下 触摸板不能使用 解决方法
- LeetCode: Distinct Subsequences [115]
- 工作日志--mfcButton和线程
- Android中的Data Binding初探 (一)
- 【LeetCode 110_二叉树_遍历】Balanced Binary Tree
- 在 VC 中,让调试器带上符号调试
- nsq源码导读(序)
- curl获取12306订票信息
- Rails当你运行一个数据库回滚错误:ActiveRecord::IrreversibleMigration exception
- jboss 5.0 安装配制负载均衡
- JAVA CAS原理深度分析
- (转)python中集合的运算
- leetcode:Summary Ranges
- HDU 1043 Eight (BFS·八数码·康托展开)
- SQL 从指定表筛选指定行信息 获取表行数
- VB获取本机网卡类型、IP、MAC地址