I am borderline competent in core C++, and am trying to familiarize myself with MFC. To do this, I am trying to write an MFC app without using App Wizard. App Wizard is great, but when you are trying to learn what is really going on, it is worthless. It creates about 5 or 6 different classes and deep header files that lose me. I want to figure how things are really working.... ie start simple...
Problem is with VC7, when I write a basic, bare bones MFC program, it won't link. Here is the code:
This is all in main.cpp---
#include <afxwin.h>
class CMainWin : public CFrameWnd
{
public:
CMainWin();
DECLARE_MESSAGE_MAP()
};
CMainWin::CMainWin()
{
Create(NULL, "Minimum MFC App"
;
}
class CApp : public CWinApp
{
public:
BOOL InitInstance();
};
BOOL CApp::InitInstance()
{
m_pMainWnd = new CMainWin;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
END_MESSAGE_MAP()
CApp App;
Here are the link errors:
nafxcwd.lib(thrdcore.obj) : error LNK2019: unresolved external symbol __endthreadex referenced in function "void __stdcall AfxEndThread(unsigned int,int)" (?AfxEndThread@@YGXIH@Z)
nafxcwd.lib(thrdcore.obj) : error LNK2019: unresolved external symbol __beginthreadex referenced in function "public: int __thiscall CWinThread::CreateThread(unsigned long,unsigned int,struct _SECURITY_ATTRIBUTES *)" (?CreateThread@CWinThread@@QAEHKIPAU_SECURITY_ATTRIBUTES@@@Z)
Debug/MFC No Wizard.exe : fatal error LNK1120: 2 unresolved externals
Is this beacuse I started out with a blank project and it does not know that I want to use MFC? I cant find any way to trick the wizards into letting me build a simple project like this.
I even build a project using App Wizard, then copied the stdafx.h file and copied over to my simple project and referenced it in my main.cpp header....no dice....same error.
Any suggestions.
Problem is with VC7, when I write a basic, bare bones MFC program, it won't link. Here is the code:
This is all in main.cpp---
#include <afxwin.h>
class CMainWin : public CFrameWnd
{
public:
CMainWin();
DECLARE_MESSAGE_MAP()
};
CMainWin::CMainWin()
{
Create(NULL, "Minimum MFC App"

}
class CApp : public CWinApp
{
public:
BOOL InitInstance();
};
BOOL CApp::InitInstance()
{
m_pMainWnd = new CMainWin;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
END_MESSAGE_MAP()
CApp App;
Here are the link errors:
nafxcwd.lib(thrdcore.obj) : error LNK2019: unresolved external symbol __endthreadex referenced in function "void __stdcall AfxEndThread(unsigned int,int)" (?AfxEndThread@@YGXIH@Z)
nafxcwd.lib(thrdcore.obj) : error LNK2019: unresolved external symbol __beginthreadex referenced in function "public: int __thiscall CWinThread::CreateThread(unsigned long,unsigned int,struct _SECURITY_ATTRIBUTES *)" (?CreateThread@CWinThread@@QAEHKIPAU_SECURITY_ATTRIBUTES@@@Z)
Debug/MFC No Wizard.exe : fatal error LNK1120: 2 unresolved externals
Is this beacuse I started out with a blank project and it does not know that I want to use MFC? I cant find any way to trick the wizards into letting me build a simple project like this.
I even build a project using App Wizard, then copied the stdafx.h file and copied over to my simple project and referenced it in my main.cpp header....no dice....same error.
Any suggestions.