'Hcrypthash ': Undeclared Identifier-similar error Solution

Source: Internet
Author: User
Tags crypt
Compile a CPP Program When <wincrypt. h> is included, an error is returned.

D: \ crypt. cpp (20): Error c2065: 'hcrypthash ': Undeclared identifier
D: \ crypt. cpp (20): Error c2146: syntax error: Missing '; 'before identifier 'hhash'
D: \ crypt. cpp (20): Error c2065: 'hhash': Undeclared identifier
D: \ crypt. cpp (22): Error c2065: 'hcryptkey': Undeclared identifier
D: \ crypt. cpp (22): Error c2146: syntax error: Missing '; 'before identifier 'hkey'
D: \ crypt. cpp (22): Error c2065: 'hkey': Undeclared identifier
D: \ crypt. cpp (24): Error c2065: 'hcryptprov': Undeclared identifier
D: \ crypt. cpp (24): Error c2146: syntax error: Missing '; 'before identifier' hprov'
D: \ crypt. cpp (24): Error c2065: 'hprov': Undeclared identifier
D: \ crypt. cpp (32): Error c2065: 'cryptacquirecontext': Undeclared identifier
D: \ crypt. cpp (38): Error c2065: 'cryptcreatehash': Undeclared identifier
D: \ crypt. cpp (54): Error c2065: 'crypthashdata': Undeclared identifier
D: \ crypt. cpp (70): Error c2065: 'cryptderivekey': Undeclared identifier
D: \ crypt. cpp (105): Error c2065: 'cryptencrypt': Undeclared identifier
D: \ crypt. cpp (151): Error c2065: 'cryptdestroyhash': Undeclared identifier
D: \ crypt. cpp (157): Error c2065: 'cryptdestroykey': Undeclared identifier

The reason is:

The _ win32_winnt macro is not defined by default in vc6.
In wincrypt. H
# If (_ win32_winnt> = 0x0400)
...
# Endif

Solution:
Add in stdafx. h

# Ifndef _ win32_winnt
# DEFINE _ win32_winnt 0x0400
# Endif

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.