# Thread: SAPI5.1 Text To Speech

1. ## SAPI5.1 Text To Speech

Hi,
I'm trying to learn how to use the SAPI5.1 SDK, and I found a small tutorial online, but I can't seem to compile it. I'm using DevC++ and when I try and compile I get an error from the sapi.h file.
The errors were...

2 C:\Dev-Cpp\Projects\Test.cpp In file included from Test.cpp
3536 C:\Program Files\Microsoft Speech SDK 5.1\Include\sapi.h invalid use of undefined type `struct IServiceProvider'
90 C:\Dev-Cpp\include\ocidl.h forward declaration of `struct IServiceProvider' .
C:\Dev-Cpp\Projects\Makefile.win [Build Error] [Test.o] Error 1

And here is the code I was trying to compile...

Code:
```#include <sapi.h>

ISpVoice* Voice = NULL;				// The voice interface

int main ( int NumOfArguments, char** Argument )
{
// Initialize COM
CoInitialize ( NULL );

// Create the voice interface object
CoCreateInstance ( CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void**)&Voice );

// Speak!
Voice -> Speak ( L"Hello World!!!", SPF_DEFAULT, NULL );

// Shutdown the voice
if ( Voice != NULL ) Voice -> Release (); Voice = NULL;

// Shutdown COM
CoUninitialize ();

return 0;
}```
Examples code would be helpful if necessary and I got this sample code from this website. http://www.gamedev.net/reference/art...rticle1904.asp
Thanks,
Blair