菜鸟求教!
/*第一段代码*/
#include<afxwin.h>
class helloWindow:public CFrameWnd
{
CStatic *cs;
public:
helloWindow()
{
Create(NULL,"Hello world",WS_OVERLAPPEDWINDOW,CRect(0,0,200,200));
cs=new CStatic();
cs->Create("hello world",WS_CHILD|WS_VISIBLE|SS_CENTER,CRect(50,80,150,150),this);
}
};
class chelloApp:public CWinApp
{
public:
virtual BOOL initInstance()
{
m_pMainWnd=new helloWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
};
chelloApp myApp;
/*第二段代码*/
#include<afxwin.h>
class interf: public CFrameWnd
{
public:
interf();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
class winApp: public CWinApp
{
BOOL InitInstance();
};
winApp myWin;
BEGIN_MESSAGE_MAP(interf,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
interf::interf()
{
Create(NULL,_T("The Hello Application"));
}
void interf::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
dc.DrawText(_T("Hello, MFC!"),-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
BOOL winApp::InitInstance()
{
m_pMainWnd=new interf();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
我建的工程是win32 application,
为啥上面的任一一段代码在编译时出现如下错误呢:
--------------------Configuration: p14 - Win32 Debug--------------------
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/p14.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
p14.exe - 3 error(s), 0 warning(s)
谢谢