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