Multithreading problem in Win32
-
When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578
-
When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578
AfxBeginThread is an MFC function. The function essentially wraps up the old C++
_beginthreadex
function. If you're only using plain old Win32, you'll need to use this function instead. Joel Holdsworth -
When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578
In addition to Joel's answer, you should also select for 'multi-threaded DLL' in the 'code generation' section of the project's C/C++ properties.
Software Zen:
delete this;
-
When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578
If you are using MFC, have you included afxmt.h in your stdafx.h file? Joel Holdsworth
-
When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578
I am trying to create the thread inside a class: class ThreadClass { public: //... bool StartThread(); DWORD WINAPI ThreadFunc( LPVOID lpParam ); //... }; bool ThreadClass::StartThread() { DWORD dwThreadId, dwThrdParam = 1; HANDLE hThread; hThread = CreateThread( NULL, // default security attributes 0, // use default stack size ThreadFunc, // thread function &dwThrdParam, // argument to thread function 0, // use default creation flags &dwThreadId); // returns the thread identifier return true; } DWORD WINAPI ThreadClass::ThreadFunc( LPVOID lpParam ) { //do whatever here return 0; } this produces this error: error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD (LPVOID)' to 'LPTHREAD_START_ROUTINE' Any ideas why it is doing this / how to fix it? Any help is appreciated. -Dev578
-
I am trying to create the thread inside a class: class ThreadClass { public: //... bool StartThread(); DWORD WINAPI ThreadFunc( LPVOID lpParam ); //... }; bool ThreadClass::StartThread() { DWORD dwThreadId, dwThrdParam = 1; HANDLE hThread; hThread = CreateThread( NULL, // default security attributes 0, // use default stack size ThreadFunc, // thread function &dwThrdParam, // argument to thread function 0, // use default creation flags &dwThreadId); // returns the thread identifier return true; } DWORD WINAPI ThreadClass::ThreadFunc( LPVOID lpParam ) { //do whatever here return 0; } this produces this error: error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD (LPVOID)' to 'LPTHREAD_START_ROUTINE' Any ideas why it is doing this / how to fix it? Any help is appreciated. -Dev578