Trouble with Speech SDK 5.1 and Visual Studio 2005

Hi
I updated my version of Vs 2003 to Vs 2005 Pro . My project was sucessfully compilated and linked in 2003 , but i seem to have trouble with SpHelper.h. ( Speech API)


Error 18 error C2065: 'psz' : undeclared identifier F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 2373 
Error 38 error C2065: 'psz' : undeclared identifier F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 2373 
Error 70 error C2065: 'psz' : undeclared identifier F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 2373 
Error 7 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 769 
Error 16 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 1419 
Error 27 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 769 
Error 36 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 1419 
Error 59 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 769 
Error 68 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int F:\Program Files\Microsoft Speech SDK 5.1\Include\sphelper.h 1419 




Answer this question

Trouble with Speech SDK 5.1 and Visual Studio 2005

  • Kgomong

    Nobody seem to answer :|
    I espect Microsoft to change the lib very soon.

  • John Schleicher

    This is how the C++ language works: a variable that is defined in a for-loop, like psz, cannot be used outside of the for-loop. You should either change your code to something like:

    const WCHAR* psz;

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

    return psz + 1;

    Or add /Zc:forScope- to your compiler options so that it will revert to the old, non-standard, behavior.



  • tommy khan

    You have to change the header manually by yourself or to wait for the update of SDK. I think these errors are mainly due to the bad coding style of the writer of the header
  • Jonathan Pickard UK

    cuski wrote:
    Not necessary. We've been experiencing the same problem, but sifting through older newsgroups, we turned of the Treat wchar_t as Built-in Type compiler option off.

    The missing default type and the declaration within the for loop still need to be fixed though.

    My solution is a workaround, but I would much rather get an updated version for the Speech SDK for VS 2005 ASAP.

    Can anybody at MS shed some light on when we might have one

    I agree, this needs to be fixed by microsoft ASAP, it is so much pain to go through this misery line by line.


  • Cappy Popp

    I'm not sure if these steps 'fix' the errors, but they permit the code to compile (honestly, I couldn't be bothered to try and decode the awful code in that file so I just used best-guess to what was intended in each case). I didn't test speech-to-text, but the text-to-speech will definitely work correctly.

    1) line 2560
    SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId);

    2) line 2634
    pphoneId += wcslen((const wchar_t *)pphoneId) + 1;

    3) line 2372 and 2373
    const WCHAR *psz;
    for (psz = (const WCHAR *)lParam; *psz; psz++) {}

    4) add to the top of the file to prevent all the other errors...
    #pragma warning( disable : 4430 )

    I also added another line to prevent a stream of 'deprecated function' warnings
    #pragma warning( disable : 4996 )




  • scotland

    I managed to fix all the sphelper.h errors except for two:

    The first one is located on line 2560. The code is:

    SPPHONEID* pphoneId = dsPhoneId;

    Where dsPhoneId is an instance of the CSpDynamicString class (what you are seeing is apparantly a poor attempt at using an overloaded = operator).

    The second one is located on line 2634. The code is:

    pphoneId += wcslen(pphoneId) + 1;

    Where pphoneId is a pointer to an unsigned short. I assume the coder wanted to take the length of the unsigned short array, but failed (since wcslen takes wchar_t * as its only argument). Perhaps what the coder meant was ++pphoneId

    Anyone willing to look at the sphelper.h code and help rectify these two errors I have no idea about the former one, and only a rough idea on the latter.



  • Gerald.Wright

    Please take a look at the header and see if it adheres to the new changes in VC2005 as Jonathan is indicating.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • Dinesh Bhat

    These may well be valid error messages (especially the C4430 ones) but with out more detail it is impossible to say.

    What might help is showing us what sphelper.h lines 769, 1419, and 2372 look like.

  • Chrislm

    Hello, I'm having the exact problem he is having.  I've also had some other problems with my code, but those were more easily fixed.  Can anyone help with this

  • Nanda Motikane

    The best way you can have control over what Microsoft will fix in their next release (VS2005 SP1, 3rd quarter of this year) is by opening a bug in Product Feedback:

    http://lab.msdn.microsoft.com/productfeedback/Default.aspx


  • fantacmet

    const ulLenVendorPreferred = wcslen(pszVendorPreferred);



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

    return psz + 1;



    It`s there a way to filter those compilator error


  • Meaks

    Not necessary. We've been experiencing the same problem, but sifting through older newsgroups, we turned of the Treat wchar_t as Built-in Type compiler option off.

    The missing default type and the declaration within the for loop still need to be fixed though.

    My solution is a workaround, but I would much rather get an updated version for the Speech SDK for VS 2005 ASAP.

    Can anybody at MS shed some light on when we might have one

  • Alexan

    I know but this is not on my code, the Speech API is a library that i download from Microsoft website , I dont want to try to make change just because they dont update it. Maybe im wrong

  • Pete4096

    that works, Thanks Pete



  • Trouble with Speech SDK 5.1 and Visual Studio 2005