SAPI contains sphelper. h compilation error Solution

Source: Internet
Author: User
Tags sapi

When developing a Speech recognition program using Microsoft Speech SDK 5.1, it contains the header file "sphelper. h" and library file "sapi. lib ". Compilation error: 1> c:/program files/microsoft speech sdk 5.1/include/sphelper. h (769): error C4430: missing type specifier-int assumed.
Note: C ++ does not support default-int1> c:/program files/microsoft speech sdk 5.1/include/sphelper. h (1419): error C4430: missing type specifier-int assumed. note: C ++ does not support default-int
1> c:/program files/microsoft speech sdks 5.1/include/sphelper. h (2373): error C2065: 'psz': undeclared identifier1> c:/program files/microsoft speech sdk 5.1/include/sphelper. h (2559): error C2440: 'initializing': cannot convert from 'cspdynamicstring' to 'spphoneid
*'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1> c:/program files/microsoft speech sdks 5.1/include/sphelper. h (2633): error C2664: 'wcslen': cannot convert parameter 1 from 'spphoneid * 'to 'const wchar_t *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

After a circle is searched, according to your experience, it should be because the Speech code was written too early and the syntax was not strict. VS2005 is very strict with syntax checks, resulting in compilation failure.

Modify the following lines in the header file to compile normally:

Ln 1, 769

Const ulLenVendorPreferred = wcslen (pszVendorPreferred );

Const unsigned long ulLenVendorPreferred = wcslen (pszVendorPreferred );

Ln 1, 1418

Static CoMemCopyWFEX (const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)

Static HRESULT CoMemCopyWFEX (const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX)

Ln 1, 2372

For (const WCHAR * psz = (const WCHAR *) lParam; * psz; psz ++ ){}

Const WCHAR * psz; for (psz = (const WCHAR *) lParam; * psz; psz ++ ){}

Ln 2559

SPPHONEID * pphoneId = dsPhoneId;

SPPHONEID * pphoneId = (SPPHONEID *) (WCHAR *) dsPhoneId );

Ln 1, 2633
PphoneId + = wcslen (pphoneId) + 1;
PphoneId + = wcslen (const wchar_t *) pphoneId) + 1; well, after compilation, You can formally compile the program logic below.

 

From: http://hi.baidu.com/xicao54007/item/af374860c275ed93c4d2492a

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.