用VS2008直接打mfc widnows程序设计中的源码就没问题,如果自己建个空项目把cpp和h头文件贴过去就报错.
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
1>已將建置記錄儲存於 "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\test\Debug\BuildLog.htm"不知道需要设置啥
下面是源码.#include <afxwin.h>
#include "Hello.h"CMyApp myApp;/////////////////////////////////////////////////////////////////////////
// CMyApp member functionsBOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functionsBEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect); dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
1>已將建置記錄儲存於 "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\test\Debug\BuildLog.htm"不知道需要设置啥
下面是源码.#include <afxwin.h>
#include "Hello.h"CMyApp myApp;/////////////////////////////////////////////////////////////////////////
// CMyApp member functionsBOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functionsBEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect); dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货