我在VC6里建了一个项目,名叫MYAPP
包含MyAPP.h和MyApp.cpp
MyAPP.h代码为: //application class
class CMyApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};//frame windows class
class CMyFrame: public CFrameWnd
{
public:
CMyFrame();
protected:
//"afx_msg" indicates that the next two functions are part
//of the MFC library message dispatch system
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};MyApp.cpp代码为:
#include <afxwin.h> // MFC library header file declares base classes
//#include <nafxcwd.lib>
#include "myapp.h"CMyApp theApp;      //the one and only CMyapp objectBOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMyFrame();
m_pMainWnd ->ShowWindow(m_nCmdShow);m_pMainWnd ->UpdateWindow();
return TRUE;
}BEGIN_MESSAGE_MAP(CMyFrame,CFrameWnd)
ON_WM_LBUTTONDOWN()
ON_WM_PAINT()
END_MESSAGE_MAP()CMyFrame::CMyFrame()
{
Create(NULL,"MYAPP Applications");
}void CMyFrame::OnLButtonDown(UINT nFlags,CPoint point)
{
TRACE("Entering CMyFrame::OnLButtonDown -%lx,%d,%d\n"),
(long) nFlags,point.x,point.y;
}void CMyFrame::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(0,0,"Hello,world!");
}编译通过没有出错,但build时出错,出现以下提示: 
--------------------Configuration: MYAPP - Win32 Debug--------------------
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/MYAPP.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.MYAPP.exe - 3 error(s), 0 warning(s)但设置ALT+F7->C/C++/->Catalog->Code Generation
MultiThread后,就可以正常build了。请问达人们这是为什么呢?

解决方案 »

  1.   

    project setting 里面设置一下!
      

  2.   

    它们说的都是错误。这与多线程无关。这是初学者见到的最多且最难又最简单的问题。
    //主要原因是在VC6 Project->Settings->General->Microsoft Foundation Class:选择使用MFC Static
    Libary.或MFC Dynamic Libary.就好了.很都书都抄这样的一个例子。只是给读者说建立一个Win32工程。把这些文件包含过去。就可以了,对于初学者来说....-----》可以了吗?  VC的程序本来初学就比别的开发工具难.让初学者觉得VC很难。其实是一些书误人子弟。
      

  3.   

    freebird_top(自由鸟)非常感谢你!
    你的意思是说程序未包括MFC库,所以出错,是这样理解么?