Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compilation error in SAPI 5.3, Visual Studio 2008

52 views
Skip to first unread message

McMath@discussions.microsoft.com David McMath

unread,
Aug 24, 2009, 7:02:01 PM8/24/09
to

I recently got Vista and would like to write some toys with text-to-speech.
I downloaded SAPI 5.3 and Visual Studio 2008.

My second example was cribbed from the ISpVoice::SetOutput documentation.
Unfortunately, it won't compile past

#include <sphelper.h>

because I get the errors

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-int
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
c:\program files\microsoft speech sdk 5.1\include\sphelper.h(2373) : error
C2065: 'psz' : undeclared identifier
c:\program files\microsoft speech sdk 5.1\include\sphelper.h(2559) : error
C2440: 'initializing' : cannot convert from 'CSpDynamicString' to 'SPPHONEID
*'
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called
c:\program files\microsoft speech sdk 5.1\include\sphelper.h(2633) : error
C2664: 'wcslen' : cannot convert parameter 1 from 'SPPHONEID *' to 'const
wchar_t *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast

The first, three, at least, all seem quite legitimate to me when I look at
sphelper.h itself (I can't say much about the others; maybe there's a typedef
dropped somewhere).

These are all compiler errors on my completely vanilla, newly-installed
samples, and they're in the headers of the SAPI SDK itself. I wonder if
there's a patch or something I'm missing?

Thanks for any help,

dave

angel

unread,
Aug 27, 2009, 4:33:01 PM8/27/09
to
I had the same issues . I just added the "int" declaration where needed and
cast the pointer to that of the function.

Kernel Developer@discussions.microsoft.com Linux Kernel Developer

unread,
Oct 28, 2009, 7:16:02 AM10/28/09
to
Hi. I am a programmer from China, and when I developped TTS program, I
encountered the same problem. Searched so many site and I found the answer at
last. It seems that the "sphelper.h" is too old while vs2005 and upper
version require a more strict grammer check.
so u can patch the header file as below:

Ln 769
const ulLenVendorPreferred = wcslen(pszVendorPreferred);
const unsigned long ulLenVendorPreferred = wcslen(pszVendorPreferred);

Ln 1418
static CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX **
ppCoMemWFEX)
static HRESULT CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX **
ppCoMemWFEX)

Ln 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 2633
pphoneId += wcslen(pphoneId) + 1;
pphoneId += wcslen((const wchar_t *)pphoneId) + 1;

Still there is warning, but it can pass the compile and works well on my
vs2005.

Besides, there are still a lot of grammer errors in the sample's code.
Though it's really little errors, it sucks me.
I just can't believe these codes were written by MS's facility.

0 new messages