compiling problem with ms visual c++
Question posted by: cppaddict
(Guest)
on
July 19th, 2005 08:12 PM
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);
}
1
Answer Posted
"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
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 197,002 network members.
Top Community Contributors
|