Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] SAPI : Build Error
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] SAPI : Build Error

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anne
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What version of Qt did you install ?

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anne
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anne
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Anne
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved