AfxBeginThread

heres my stdafx.h code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifdef WINDOWS

#define WINVER 0x0600

#include <Afxwin.h>
#include <winsock2.h>
#include <winsock.h>
#include <windows.h>

#endif
#include <string>
#include <iostream>
#include <list>
#include <map>
#include <vector>
#include <math.h>
#include <exception>
#include <stdlib.h>
#include <sstream>
#include "core/logging/Logging.h" 


whenever i try to run the following code
AfxBeginThread(ListenProcess,0);

the compiler returns the following error
error C3861: 'AfxBeginThread': identifier not found

any help on how to resolve this please? and yes, before you ask, i have included the stdafx file
thanks.
Last edited on
Are you building an MFC application??

#ifdef WINDOWS ???
Last edited on
did u include the right libraries?:...
the additional dependencies ive included are:
ws2_32.lib
ws_32.lib
MFC42.lib
MFC42S.lib.
I still come back to this:

#ifdef WINDOWS This is suspect!
1
2
3
4
5
6
7
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif // _AFX_NO_AFXCMN_SUPPORT 


for MFC....
Last edited on
ive removed the ifdef windows...
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
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif // _AFX_NO_AFXCMN_SUPPORT 

#include <winsock2.h>
#include <winsock.h>
#include <windows.h>


#include <string>
#include <iostream>
#include <list>
#include <map>
#include <vector>
#include <math.h>
#include <exception>
#include <stdlib.h>
#include <sstream>
#include "core/logging/Logging.h"


using namespace std;


and added incubbus suggestion, but still no go... i really need this lol. thanks for your feedback and keep the suggestions coming please. thank you.
Last edited on

Say if you have a windows console program and you want to add MFC support try this:

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
45
46
#define _AFXDLL //<<===notice this

#include <Afxwin.h>
#include <winsock2.h>
#include <winsock.h>
#include <windows.h>



#include <iostream>
//other C++ standard headers here as required
using namespace std;



// The one and only application object
CWinApp theApp;



UINT ThreadProc(LPVOID pParam)
{
  return 0;
}



int _tmain(int argc, _TCHAR* argv[])
{
	
  
  	// initialize MFC
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		_tprintf(_T("Fatal Error: MFC initialization failed\n"));
		return 1;
	}


	AfxBeginThread(ThreadProc,0);
  
  
  
  return 0;
}


Notice the #define _AFXDLL and the AfxWinInit function to initialise the MFC subsystem
thanks but none of the solutions work
Topic archived. No new replies allowed.