Interview Question in Visual Studio 2005


 

Interview Question :: C++/MFC compilation error, help (c++ newbie)

hi, i'm trying to learn using MFC and the first example i tried out didn't compile on visual c++ 2005. here it is:
i created a win32 empty project and added one source file with the following:

---

#include <afxwin.h>


class CMyApp : CWinApp
{
public:
virtual BOOL InitInstance();
};

class CMyWindow : CFrameWnd
{
public:
CMyWindow()
{
Create(0, L"My first app, ehi2");
}
};


BOOL CMyApp::InitInstance()
{
m_pMainWindow = new CMyWindow;

m_pMainWindow->ShowWindow(m_nCmdShow)...
return TRUE;
}

CMyApp App;

-------

when i compile it says:
"Error 1 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] c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h 24 "

what should i do?
by ksk
c++