C++ AfxBeginThread函数的偏差在哪里?

C++ AfxBeginThread函数的偏差在哪里?,c++,multithreading,C++,Multithreading,这段代码使用带有AfxBeginThread函数的线程,但我不知道应该在项目中包含哪些头文件? 有人能帮忙吗 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; cout << "Press ESCAPE to terminate program\r\n"; AfxBeginThread(ServerThread,0); while(_getch()!=2

这段代码使用带有AfxBeginThread函数的线程,但我不知道应该在项目中包含哪些头文件?
有人能帮忙吗

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
    int nRetCode = 0;   

    cout << "Press ESCAPE to terminate program\r\n";
    AfxBeginThread(ServerThread,0);
    while(_getch()!=27);

    return nRetCode;
}
int\u tmain(int-argc,TCHAR*argv[],TCHAR*envp[]
{
int nRetCode=0;

cout对于
AfxBeginThread
您将需要
afxwin.h
您还应添加:
\define\u afxdell

以下是一个例子:

#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;
    }

    int nRetCode = 0;  
    cout << "Press ESCAPE to terminate program\r\n";


    AfxBeginThread(ThreadProc,0);

    while(_getch()!=27);

    return nRetCode;

}

#define#afxdl//你能提供更多关于你的代码的详细信息吗我只想知道AfxBeginThread函数在哪里被删除……我建议你经历错误1错误C1189:#错误:使用/MD[d](CRT dll版本)构建MFC应用程序需要MFC共享dll版本。请#define#afxdl或不使用/MD[d]c:\program files\microsoft visual studio 12.0\vc\atlmfc\include\afx.h 242 IntelliSense:#错误指令:使用/MD[d](CRT dll版本)构建MFC应用程序需要MFC共享dll版本。请#定义"AFXDLL或不使用/MD[d]c:\Program Files\Microsoft Visual Studio 12.0\VC\atlmfc\include\afx.h 24错误1错误C1189:#错误:使用/MD[d](CRT dll版本)构建MFC应用程序需要MFC共享dll版本。请#定义#AFXDLL或不使用/MD[d]c:\Program Files\Microsoft Visual Studio 12.0\VC\atlmfc\include\afx.h 24