Connecting Tech Pros Worldwide Help | Site Map

compiling problem with ms visual c++

cppaddict
Guest
 
Posts: n/a
#1: Jul 19 '05
Hi,

I am trying to compile the first example of Jeff Prosise's book "Programming
Windows with MFC Second Edition" using Visual C++ version 7.1. The example
is very simple and consists of only two files (included below). Following
the book's instructions, I select a Win32 Application with empty project
selected, and add the two files. The compiler lists 2 unresolved externals
as the problem. I think it has to do with the version, b/c the book assumes
you are using the Visual C++ 6 IDE. Does anyone know how to fix the
problem?

Thanks,
cpp

Here are the two files:

hello.h
----------------------
class CMyApp : public CWinApp {
public:
virtual BOOL InitInstance();
};

class CMainWindow : public CFrameWnd {
public:
CMainWindow();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP();
};

hello.cpp
--------------------------------
// hello.cpp : Defines the entry point for the console application.
//

#include <afxwin.h>
#include "stdafx.h"
#include "hello.h"

CMyApp myApp;

BOOL CMyApp::InitInstance() {
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow;
return TRUE;
}

BEGIN_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);
}


Mike Wahler
Guest
 
Posts: n/a
#2: Jul 19 '05

re: compiling problem with ms visual c++


"cppaddict" <cppaddict@yahoo.com> wrote in message
news:10Qib.88$k37.21853388@newssvr21.news.prodigy. com...[color=blue]
> Hi,
>
> I am trying to compile the first example of Jeff Prosise's book[/color]
"Programming[color=blue]
> Windows with MFC Second Edition" using Visual C++ version 7.1.[/color]

Answers are available at:
microsoft.public.vc.mfc

Purpose of comp.lang.c++:
http://www.slack.net/~shiva/welcome.txt

-Mike


Closed Thread