problem with integrate sapi in codeblocks ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
#include <ctime>
#include <sapi.h>
using namespace std;

//type something in to have it spoken!
//enter quit to exit
int main(int argc, char* argv[])
{	std::string Response[] = {
		"HELLO",
		"HOW ARE YOU?",
		"BYE.",
		"AWSOME.",
		"SHAZAM!!!"
	};

	srand((unsigned) time(NULL));

	std::string sInput = "";
	std::string sResponse = "";

	int nSelection =0;

	srand((unsigned) time(NULL));

	while(1) {
		std::cout << ">";
		std::getline(std::cin, sInput);

		nSelection = rand() % 5;
		sResponse = Response[nSelection];
		std::cout << sResponse << std::endl;

		if(sInput == "q")   //a way to break the loop !
		{	std::cout << "CYA LATER XD";
			break;
		}
	}
char temp;
cin >> temp; //simple pause before exiting

return 0;
}


i'm stuck on it ...any help will make my day ! I WANT MY PC SAY SOMETHING
the problem is it's always error in sapi.h header file..
i don't wanna code in visual because my pc is too weak ...so if you can give me a code that i can build success you will be my guardiance
Last edited on
the problem is it's always error in sapi.h header file..
What kind of error ?

Did you install the SAPI SDK ?
Did you link sapi.lib
Last edited on
See if this helps?

http://forums.codeguru.com/showthread.php?427243-what-is-IServiceProvider-It-s-in-my-compilation-error


Try including following before sapi.h

Code:
1
2
#include<windows.h>
#include <Servprov.h> // for IServiceProvider 




MSDN is the best location to find solutions to compiler and linker errors, for example, whenever you get such linker error (for any windows API), try looking for that API in MSDN, it has details of header file and library file you need to use, for example following details are shown for CoInitialize on MSDN,

Quote Originally Posted by MSDN
1
2
3
4
5
6
7
8
9
10
Requirements
For an explanation of the requirement values, see Requirements (COM).

Windows NT/2000/XP: Requires Windows NT 3.1 or later.

Windows 95/98: Requires Windows 95 or later.

Header: Declared in objbase.h.

Library: Use ole32.lib.
Last edited on
still get errors...nothing be fixed
i have no idea what API you was talking about
1/ does it make me fix my errors faster
2/ is it compatible with my codeblocks
3/ can we use it offline ? and where is the link,how to use
Last edited on
alo
thanks guys...
i have finally known the circumstance...because the sequence of header files libraris
you need to to this in sequence
Topic archived. No new replies allowed.