• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

Trying to Spawn a Thread

I am trying to get my application to be multithreaded.I created a class called CConnectThread derived from base class
CWinThread.The class view can see this class and I added the necassary header files to the class as well.
But when I try something like

CConnectThread *p=
      (CConnectThread)AfxBeginThread( RUNTIME_CLASS(CConnectThread),THREAD_PRIORITY_NORMAL,0);

I get compiler error
 error C2065: 'CConnectThread' : undeclared identifier
I 'd appreciate any help with tihis.
1 Solution
You need to include the CConnectThread header file in the cpp file that contains the AfxBeginThread call.

Something like this:

#include "stdafx.h"
#include "ConnectThread.h"

// ...

CConnectThread* pConnectThread = (CConnectThread*)AfxBeginThread(RUNTIME_CLASS(CConnectThread), THREAD_PRIORITY_NORMAL, 0);

// ...


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now