Trying to Spawn a Thread

Posted on 2005-05-17
Last Modified: 2006-11-18
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.
Question by:samroyc
    1 Comment
    LVL 9

    Accepted 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

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now