我想做一个服务,用向导生成一个Win32 console application:int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0; // initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
::SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ ServiceName, ServiceMain },
{ NULL, NULL }
}; StartServiceCtrlDispatcher (DispatchTable); CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
} return nRetCode;
}但编译时显示SERVICE_TABLE_ENTRY 未定义,加上::后显示SERVICE_TABLE_ENTRY 不是“global namespace"成员
C:\CommuServ\CommuServ.cpp(46) : error C2039: 'SERVICE_TABLE_ENTRY' : is not a member of '`global namespace''
{
int nRetCode = 0; // initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
::SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ ServiceName, ServiceMain },
{ NULL, NULL }
}; StartServiceCtrlDispatcher (DispatchTable); CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
} return nRetCode;
}但编译时显示SERVICE_TABLE_ENTRY 未定义,加上::后显示SERVICE_TABLE_ENTRY 不是“global namespace"成员
C:\CommuServ\CommuServ.cpp(46) : error C2039: 'SERVICE_TABLE_ENTRY' : is not a member of '`global namespace''
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货