Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] SAPI : Build Error
I want to run this code in Qt
//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;
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
hr = pVoice->Speak(L"Hello world",0,NULL);
pVoice = NULL;
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
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
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
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
thank you very much for your help
I re-install Qt 4.8 using msvc2010 as default compiler .