MFC WINDOWS程序设计(第2版)第一个例子程序hello.h
//////////////////////////////
class CMyApp: public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainWindow: public CFrameWnd
{
public:
CMainWindow();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};hello.cpp
/////////////////////////////////
#include <afxwin.h>
#include "hello.h"CMyApp myApp;BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMainWindow;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;
}
BEGIN_MESSAGE_MAP(CMainWindow,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()CMainWindow::CMainWindow()
{
Create(NULL,_T("对话框"));
}void CMainWindow::OnPaint()
{
////////////////////
}然后编译CPP文件会报错
加入头文件后编译无错,但是连接的时候出错旁边的工作区有两个类
自己修改了编译的选项加入了MFC所需要的DLL
为什么还报错/////////////////////////////////////////////////
Compiling...
HELLO.CPP
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/HELLO.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
为什么啊,应该怎么做啊
//////////////////////////////
class CMyApp: public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainWindow: public CFrameWnd
{
public:
CMainWindow();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};hello.cpp
/////////////////////////////////
#include <afxwin.h>
#include "hello.h"CMyApp myApp;BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMainWindow;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;
}
BEGIN_MESSAGE_MAP(CMainWindow,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()CMainWindow::CMainWindow()
{
Create(NULL,_T("对话框"));
}void CMainWindow::OnPaint()
{
////////////////////
}然后编译CPP文件会报错
加入头文件后编译无错,但是连接的时候出错旁边的工作区有两个类
自己修改了编译的选项加入了MFC所需要的DLL
为什么还报错/////////////////////////////////////////////////
Compiling...
HELLO.CPP
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/HELLO.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
为什么啊,应该怎么做啊
给你上面两个文件一个CPP一个头文件,然后怎么做
望高人指点