compiling problem with ms visual c++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cppaddict

    compiling problem with ms visual c++

    Hi,

    I am trying to compile the first example of Jeff Prosise's book "Programmin g
    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::InitIns tance() {
    m_pMainWnd = new CMainWindow;
    m_pMainWnd->ShowWindow(m_n CmdShow);
    m_pMainWnd->UpdateWindow ;
    return TRUE;
    }

    BEGIN_MESSAGE_M AP (CMainWindow, CFrameWnd)
    ON_WM_PAINT()
    END_MESSAGE_MAP ()

    CMainWindow::CM ainWindow() {
    Create (NULL, _T ("The Hello Application"));
    }

    void CMainWindow::On Paint() {
    CPaintDC dc(this);
    CRect rect;
    GetClientRect(& rect);
    dc.DrawText(_T( "Hello, MFC"), -1, &rect, DT_SINGLELINE | DT_CENTER |
    DT_VCENTER);
    }


  • Mike Wahler

    #2
    Re: [OT, redir, welcome msg] compiling problem with ms visual c++

    "cppaddict" <cppaddict@yaho o.com> wrote in message
    news:10Qib.88$k 37.21853388@new ssvr21.news.pro digy.com...[color=blue]
    > Hi,
    >
    > I am trying to compile the first example of Jeff Prosise's book[/color]
    "Programmin g[color=blue]
    > Windows with MFC Second Edition" using Visual C++ version 7.1.[/color]

    Answers are available at:
    microsoft.publi c.vc.mfc

    Purpose of comp.lang.c++:


    -Mike


    Comment

    Working...