Connecting Tech Pros Worldwide Help | Site Map

compiling problem with ms visual c++

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 19th, 2005, 07:12 PM
cppaddict
Guest
 
Posts: n/a
Default compiling problem with ms visual c++

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



  #2  
Old July 19th, 2005, 07:12 PM
Mike Wahler
Guest
 
Posts: n/a
Default Re: [OT, redir, welcome msg] 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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

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 220,840 network members.