Please have a look at the following code
#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>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout << "Hello" << endl;
ISpVoice * pVoice = NULL;
if (FAILED(::CoInitialize(NULL)))
return FALSE;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
cout << "Succeeded" << endl;
hr = pVoice->Speak(L"Hello world", 0, NULL);
pVoice->Release();
pVoice = NULL;
}
else
{
cout << "Not succeeded" << endl;
}
::CoUninitialize();
return TRUE;
}
I am using QT. When I run this code, I get the error
Cannot open include file: 'atlbase.h': No such file or directory
I noticed that I do not have the files atlbase.h
or atlcom.h
in my machine. However, this code runs without error in my laptop, and I got those 2 files there.
I am thinking about getting a copy of those 2 files into my desktop computer and will it work? If yes, to which folder do I have to copy them? I am new to Windows programming, QT and speech.