| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C++ (Non Visual C++ Issues) Ask or answer C and C++ questions not related to Visual C++. This includes Console programming, Linux programming, or general ANSI C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to get Microsoft Speech SAPI to work in DEV C++ IDE
Hi;
I have been working on a c++ project with DevC++ IDE. I decided to use the Microsoft Speech SAPI in my project. But couldn't get it to compile with Dev C++. However it was trivial to get the code below to compiles in Visual Studio 2005. So I bought Visual Studio 2005 and tried to move all my code over to VIsual studio 2005. But there were too many other problems - problems i can't debug - can't get my program to run without error when compiled under Visual Studio. So I'm going back to the drawing board and trying to figure out how to get the following speech code to compile under Dev C++ 4.9.9.2. Here I have given you all the entire Code below. If there is a Guru out there who can figure out how to compile this code in Dev C++ , I would really appreciate the solution. Code:
#include <cstdlib>
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include <Servprov.h>
#include <sapi.h>
#include <string>
// SAPI Sample 1.cpp : Defines the entry point for the console application.
using namespace std;
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 );
//this is one technique to convert a char* to a WCHAR* which is the
//parameter & format that the Speak function will take.
/** getting this stuff to compile under Dev C++ is another problem
char* orig="this is just a test ";
size_t origsize = strlen(orig) + 1;
const size_t newsize = 53*2;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, orig, _TRUNCATE);
*/
//Alternatively, you can pass strTest if you don't want to use mbstowcs
const WCHAR* strTest = L"I'm trying to pass this in";
// Speak!
Voice -> Speak ( strTest , SPF_DEFAULT, NULL );
// Shutdown the voice
if ( Voice != NULL ) Voice -> Release (); Voice = NULL;
// Shutdown COM
CoUninitialize ();
return 0;
}
in function 'main': [Linker error] undefined reference to 'CoInitialize@4' [Linker error] undefined reference to 'IID_ISpVoice' [Linker error] undefined reference to 'CLSID_SpVoice' [Linker error] undefined reference to 'CoCreateInstance@20' [Linker error] undefined reference to 'CoUninitialize@0' Id returned 1 exit status [Build Error] Error 1 ---------------------------------- Under Dev C++ Project Properties I have the following: Under Includes: D:\Program Files\Microsoft Speech SDK 5.1\Include Under Libraries: D:\Program Files\Microsoft Speech SDK 5.1\Lib\i386 D:\Program Files\Microsoft Speech SDK 5.1\IDL D:\Program Files\Microsoft Speech SDK 5.1\Lib D:\Program Files\Microsoft Speech SDK 5.1\Bin Under Resource Directories I have: D:\Program Files\Microsoft Speech SDK 5.1\IDL D:\Program Files\Microsoft Speech SDK 5.1\Lib D:\Program Files\Microsoft Speech SDK 5.1\Bin You must have Windows Speech 5.3 installed - if it is installed, you will see the Speech Control Panel Applet in the Control Panel of your windows machine. When you install the microsoft speech you will have all the content in those directories. To install microsoft speech all you need is http://www.microsoft.com/downloads/d...displaylang=en speechsdk51msm.exe --- 131.5 MB Thanks in advance Stev Last edited by stephenprogrammer07; July 17th, 2007 at 11:24 PM. |
|
#2
|
|||
|
|||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
Quote:
Why didn't you just fix the program? This should have been a very loud shout that you're programming was faulty and had bugs, and had nothing to do with Visual Studio. Quote:
Regards, Paul McKenzie |
|
#3
|
|||
|
|||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
Basically what I'm saying is this --
If you have a program compiled and linked for one compiler, and the program doesn't work, then there is one and only one thing that is valid to do -- fix the program then and there. Going to another compiler is not going to work -- you will still have those very same bugs if and when you successfully compile and link for the other compiler. The worst case scenario is if the other compiler hides these bugs from you when you run the program. Then you're really in trouble since your program has turned into a time bomb ready to blow up at anytime you run the program differently, or on another machine, or if you add or remove code, or for any reason under the sun. No one would want to run a potentially unstable program. The best bugs are bugs you can see for yourself and duplicate. Then they are just waiting to be addressed and fixed. Then you get to learn how to fix and address these issues. Visual C++ has one of the best debuggers for any environment, outshining and is more stable than what Dev-C++ has to offer. Regards, Paul McKenzie |
|
#4
|
|||
|
|||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
that's an interesting point.
Yes my code runs perfectly when compiled with Dev c++ - but in visual studio , here's the situation . (I was coding this app to Dev C++'s IDE for an entire year. ) NUMBER 1: The application is supposed to be pulling in an XML file using tinyXML, when I launch the application inside VS2005, the app says it can't load the XML file . But when I click the executable outside VS2005 it finds the XML file. - keep in mind the XML file is in the same place in both situations. The XML file is sitting right next to the executable in the filesystem. NUMBER 2: If I click the executable outside of the VS2005 and it starts up properly by finding the XML file , when I click the X to shut down the program it gives me a Win32 exception that tries to open in the visual studio debugger. Never had such a win32 execption error before. when I was using Dev C++. (Although my only source for viewing such error with dev c++ was that I would notice zonealarm notifying me that dr. watson was being being accessed. However i didn't see that error any more ) NUMBER 3: It's telling me it compiled everything without debugging information - so basically it's just identifying the memory location of the exception which is not helping me single bit . And it says it won't even open up the source code and point to the line with the error -- so you can imagine my frustration. I'm a complete newbie with VS2005. I just bought it with Hard-Earned Cash and installed it so I am not an expert. it has Tons of project properties -- way more than Dev c++. Perhaps you better understand the challenges I face with VS2005. none of these problems happen with Dev. i thought it was the compiler and complexity of the VS environment settings. I'm glad you mentioned the superiority of it's debugger - I would sincerely appreciate if you could tell me how I can get the VS debugger to show me how my executable is related to my source code - so i can find line number where the exception happened - most-likely a pointer. I would sincerely appreciate if you could guide me through figuring out why it can't find my XML file when running inside VS - but it finds out when clicking outside - the - the XML file is in the same directory with the executable. Thanks in Advance Stephen Last edited by stephenprogrammer07; July 18th, 2007 at 01:14 AM. |
|
#5
|
||||||
|
||||||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Regards, Paul McKenzie |
|
#6
|
|||
|
|||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
Here is the thread you didn't respond to:
http://www.codeguru.com/forum/showthread.php?t=428643 Regards, Paul McKenzie |
|
#7
|
|||
|
|||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
okay i'll try this approach.
I wasn't sure what kind of learning curve i would be looking at - in view of the time for me to finish this project. |
|
#8
|
|||
|
|||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
Sir I am interested in learning speech recognition in devcpp.Could you please guide me with the procedure and a sample program?Hoping for a positive response.
|
|
#9
|
||||
|
||||
|
Re: How to get Microsoft Speech SAPI to work in DEV C++ IDE
Quote:
On a thread that is over a year old (16 months)???? By a person who has not posted in over 2 months??? Hope you are not holding your breath.....
__________________
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009In theory, there is no difference between theory and paractice; in practice there is.
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|