c++ - Errors are generated when SAPI is run in QT -


please have @ following code

#include <sapi.h>  int main(int argc, char* argv[]) {     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; } 

this first sapi 5.1 run, , sample hello world provided ms.

i have added sapi "bin" location system variable "path".

following qt project contect (.pro content)

#------------------------------------------------- # # project created qtcreator 2013-04-26t12:59:05 # #-------------------------------------------------  qt       += core  qt       -= gui  target = tired config   += console config   -= app_bundle  template = app   sources += main.cpp \     contentdetector.cpp \     speech.cpp  includepath += c:/opencv/build/include includepath += c:/opencv/build/include/opencv includepath += "c:/program files/java/jdk1.7.0/include" includepath += "c:/program files/java/jdk1.7.0/include/win32" includepath += "c:/program files/microsoft speech sdk 5.1/include"  libs += c:/opencv/build/x86/vc9/lib/opencv_calib3d240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_contrib240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_core240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_features2d240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_flann240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_highgui240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_imgproc240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_objdetect240.lib libs += c:/opencv/build/x86/vc9/lib/opencv_video240.lib libs += "c:/program files/java/jdk1.7.0/lib/jvm.lib" libs += "c:/program files/java/jdk1.7.0/lib/jawt.lib" libs += "c:/program files/microsoft speech sdk 5.1/lib/i386/sapi.lib" 

please note sapi include in last include , sapi lib last lib.

when run code, followng error generated.

c:\users\yohan\documents\qtpeojects\tired\speech.cpp:10: error: c2143: syntax error : missing ')' before ';' c:\users\yohan\documents\qtpeojects\tired\speech.cpp:10: error: c2059: syntax error : ')' 

i not understand why. please help!

update

the above error gone after following instructions john. but, below errors generated. why that?

speech.obj:-1: error: lnk2019: unresolved external symbol __imp__couninitialize@0 referenced in function _main  speech.obj:-1: error: lnk2019: unresolved external symbol __imp__cocreateinstance@20 referenced in function _main  speech.obj:-1: error: lnk2019: unresolved external symbol __imp__coinitialize@4 referenced in function _main  release\tired.exe:-1: error: lnk1120: 3 unresolved externals 

hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **)&pvoice;); 

should be

hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **)&pvoice); 

there's semi-colon in version.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -