
Did anyone read the book "MFC programming from ground up"
Dear all,
I am a newbie of Windows programming.
I am just start reading the book "MFC programming from ground up" by Herbert
Schildt.
I attempted my first program in Chap 2, but it doesn't work.
It is the minimal MFC program.
I use Microsoft developer Studio for Visual C++ 5 complier.
I 've tried using "Win32 Application", "Win32Console", "MFC AppWizard" to
build the project. It just gave me the same error.
Do you know what's wrong with the code / linking?
How can I solve this?
Here is the error message:
____________________________________________________________________
Compiling...
CHAP2.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/chap2a.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
chap2a.exe - 4 error(s), 0 warning(s)
______________________________________________________________________
Here is the source code:
////////////////////////////////////////////////////////////////////////////
///////////////
// A minimal MFC program.
#include <afxwin.h>
// Derive essential classes.
// This is the main window class.
class CMainWin : public CFrameWnd
{
public:
CMainWin();
DECLARE_MESSAGE_MAP()
Quote:
};
// Construct a window.
CMainWin::CMainWin()
{
Create(NULL, "An MFC Application Skeleton");
Quote:
}
// This is the application class.
class CApp : public CWinApp
{
public:
BOOL InitInstance();
Quote:
};
// Initialize the application.
BOOL CApp::InitInstance()
{
m_pMainWnd = new CMainWin;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
Quote:
}
// This is the application's message map.
BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
END_MESSAGE_MAP()
CApp App; // instantiate the application
////////////////////////////////////////////////////////////////////////////
////////////////
Regards,
Calvin