I'm a complete newbie to VC++ .NET, and I wanted to learn MFC programming so I am now looking at the book "MFC Programming from the Ground Up". Unfortunately, this book was written for VC++6, and I immediately hit a roadblock when I tried the first sample.

Here's the code.
Code:

Code:
#include <afxwin.h>

// Derive essential classes.

// This is the main window class.
class CMainWin : public CFrameWnd
{
public:
    CMainWin();
    DECLARE_MESSAGE_MAP()
};

// Construct a window.
CMainWin::CMainWin()
{
    Create(NULL, "An MFC Application Skeleton");
}

// This is the application class.
class CApp : public CWinApp
{
public:
    BOOL InitInstance();
};

// Initialize the application.
BOOL CApp::InitInstance()
{
    m_pMainWnd = new CMainWin;
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();

    return TRUE;
}

// This is the application's message map.
BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
END_MESSAGE_MAP()

CApp App; // instantiate the application

Besides typing in the code, I also went into the project settings and set it to "Use MFC in a shared DLL."

When I build it, I get the following error message:
"bare_bones fatal error LNK1561: entry point must be defined"

I guess the above code works fine in VC++6, or else the book wouldn't have gotten such good reviews.

I'm just wondering, what do I have to do to make it work in .NET?

Just in case you need to know, I tried the following project settings:

First, I chose "Empty Project (.NET)".

Since that didn't work, I also tried Win32 Project (Console), with the options set as follows:
Application Type: Console Application.
Add support for MFC.
Additional Options: Empty Project (Unchecked), Precompiled Header (Unchecked).


Finally, I tried "MFC Application", then deleted all header, source, and resource files and added a new source file and pasted the code in there.

None of the above worked.