I have a situation where I need to essentially run some unit tests against a MFC application.
I basically have some gtest code in Win32 Console application that needs to be able to create a instance in code of the MFC application and basically do some assertions etc...
I tried to create a Win32 console application with MFC header included. I then included the header file of my MFC applicaton class. However, whenever I try to create an instance i.e CWindowApplicationApp the_app in my console application, I receive linking error
This is some of the source code from my console application
CWindowApplicationApp the_app;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
}
return nRetCode;
}
error LNK2019: unresolved external symbol "public: __thiscall CWindowApplicationApp::CWindowApplicationApp(void)" (??0CWindowApplicationApp@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'the_app''(void)" (??__Ethe_app@@YAXXZ)
Any help? I have included the header file paths