Did anyone read the book "MFC programming from ground up" 
Author Message
 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



Thu, 15 Nov 2001 03:00:00 GMT  
 Did anyone read the book "MFC programming from ground up"
You have to tell the compiler to link the mfc-libaries either static or
dynamic with your app. (Project->Settings)


Quote:
>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()
>};

>// 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

>///////////////////////////////////////////////////////////////////////////
/
>////////////////

>Regards,
>Calvin




Thu, 15 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Has anyone read "Professional MFC Programming"?

2. Has anyone read "Professional MFC Programming"?

3. Has anyone read "Professional MFC Programming"?

4. Has anyone read "Professional MFC Programming"?

5. Did anyone read the book "MFC programming from the ground up"?

6. "MFC Black Book" vs Kain's "MFC Answer Book"

7. C++ Programmer-"ground floor opportunity"

8. "MUST HAVE" books for MFC

9. Book: MFC Programming from the Ground Up, 2/e

10. "MUST HAVE" books for MFC

11. Book: MFC Programming from the Ground Up, 2/e

12. FS: "MFC Programming From the Ground Up"

 

 
Powered by phpBB® Forum Software