I purchased some materials to help show me how to make use of Microsoft Foundation Classes. The below program is actually one of the first example programs from the materials that I purchased. I haven't changed anything. Only problem is that after it compiles it won't link. I get the following error:
Several other programs that are provided in the materials make use of this 'working' program. I was hoping to spend some time today learning/experimenting with MFC.
The materials appear to be of very good quality. I suspect operator error on this one.....but's it's not jumping out at me and I'm too new to this environment.
Below is the error msg that I'm getting:
--------------------Configuration: basicMFC - Win32 Debug--------------------
Linking...
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/basicMFC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
basicMFC.exe - 2 error(s), 0 warning(s)
Under "project settings" within Visual Studio I've checked off "Use MFC in a Shared DLL" mode, etc. Seems like the main code is referencing an external symbol which it can't find. The name of the external symbol seems to be "_main".
I suspect this is a quick one....
help? The code is below.
thanks,
/Jerry
#include <afxwin.h>
class CMainWindow : public CFrameWnd {
public:
CMainWindow() {
Create(NULL,"Basic MFC Application"
}
protected:
afx_msg void OnPaint() {
CPaintDC dc(this);
CRect r;
GetClientRect(&r);
dc.DrawText("Basic MFC Application",-1,&r,
DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
DECLARE_MESSAGE_MAP()
};
class CMFCApp : public CWinApp {
public:
virtual BOOL 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()
CMFCApp app;
Several other programs that are provided in the materials make use of this 'working' program. I was hoping to spend some time today learning/experimenting with MFC.
The materials appear to be of very good quality. I suspect operator error on this one.....but's it's not jumping out at me and I'm too new to this environment.
Below is the error msg that I'm getting:
--------------------Configuration: basicMFC - Win32 Debug--------------------
Linking...
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/basicMFC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
basicMFC.exe - 2 error(s), 0 warning(s)
Under "project settings" within Visual Studio I've checked off "Use MFC in a Shared DLL" mode, etc. Seems like the main code is referencing an external symbol which it can't find. The name of the external symbol seems to be "_main".
I suspect this is a quick one....
help? The code is below.
thanks,
/Jerry
#include <afxwin.h>
class CMainWindow : public CFrameWnd {
public:
CMainWindow() {
Create(NULL,"Basic MFC Application"
}
protected:
afx_msg void OnPaint() {
CPaintDC dc(this);
CRect r;
GetClientRect(&r);
dc.DrawText("Basic MFC Application",-1,&r,
DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
DECLARE_MESSAGE_MAP()
};
class CMFCApp : public CWinApp {
public:
virtual BOOL 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()
CMFCApp app;