Hi all, i am writing a windows service and i am able to run the code because of the following errors in DEV-C++ Compiler
C:\Dev-Cpp\Install Service.cpp In function `void ShowErr()':
35 C:\Dev-Cpp\Install Service.cpp `cout' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
C:\Dev-Cpp\Makefile.win [Build Error] ["Install Service.o"] Error 1
The code goes like this:
//#include <iostream.h>
#include <windows.h>
#include <winsvc.h>
void ShowErr();
int main(int argc, char* argv[])
{
SC_HANDLE AbhiService,scm;
scm=OpenSCManager(0,0,SC_M
ANAGER_CRE
ATE_SERVIC
E);
if(!scm)
{
ShowErr();
return 1;
}
AbhiService=CreateService(
scm,"AbhiS
ervice",
"Beeper's first service",
SERVICE_ALL_ACCESS,SERVICE
_WIN32_OWN
_PROCESS,S
ERVICE_DEM
AND_START,
SERVICE_ERROR_NORMAL,
"D:\\Abhi\\FirstService\\D
ebug\\Firs
tService.e
xe",
0,0,0,0,0);
if(!AbhiService)
{
CloseServiceHandle(scm);
ShowErr();
return 1;
}
CloseServiceHandle(AbhiSer
vice);
CloseServiceHandle(scm);
return 0;
}
void ShowErr()
{
cout << "Error" << "\r\n";
}
can anyone please clarify what can be done?
Start Free Trial