[SOLVED] SAPI : Build Error



  • Hello,
    I want to run this code in Qt
    @#define _ATL_APARTMENT_THREADED

    #include <atlbase.h>
    //You may derive a class from CComModule and use it if you want to override something,
    //but do not change the name of _Module
    extern CComModule _Module;
    #include <atlcom.h>

    #include <sapi.h>

    int main()
    {
    ISpVoice * pVoice = NULL;
    if (FAILED(::CoInitialize(NULL)))
    return FALSE;
    HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
    if( SUCCEEDED( hr ) )
    {
    hr = pVoice->Speak(L"Hello world",0,NULL);
    pVoice->Release();
    pVoice = NULL;
    }
    ::CoUninitialize();
    return TRUE;
    }@
    then to include sapi lib, I added the folwing lines to .pro
    @INCLUDEPATH += "C:/Program Files/Microsoft Speech SDK 5.1/Include"
    LIBS += "C:/Program Files/Microsoft Speech SDK 5.1/Lib/i386/sapi.lib"@
    When I compile this code , I have the following errors :
    erreur : atlbase.h: No such file or directory
    erreur : atlcom.h: No such file or directory
    erreur : 'CComModule' does not name a type
    erreur : invalid use of incomplete type 'struct IServiceProvider'
    erreur : forward declaration of 'struct IServiceProvider'
    can you help me please


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt did you install ?

    Also atlbase.h comes with Visual Studio, did you install it ?



  • Hi, thanks for your reply.
    I work with Qt 4.8
    No I didn't install Visual Studio, I try to install it now



  • Hi ,

    I installed Visual Studio 2010 but i have the same errors, I want to make QtCreator able to compile with MSVC210 instead of MinGW but i don't know how.
    then when i delete all includes exept sapi.h , I have the following errors:
    C:\Program Files (x86)\Microsoft Speech SDK 5.1\Include\sapi.h:3536: erreur : invalid use of incomplete type 'struct IServiceProvider'

    C:\qt4\tools\mingw44\include\ocidl.h:90: erreur : forward declaration of 'struct IServiceProvider'

    this is my first step with SAPI
    thank you in advance to help me


  • Lifetime Qt Champion

    Don't forget to also install Qt 4.8 for Visual Studio 2010 otherwise you won't be able to compile.

    You must include the header defining IServiceProvider before sapi.h



  • hello ,
    thank you very much for your help
    I re-install Qt 4.8 using msvc2010 as default compiler .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.