Hi All,
I have come across a problem with a bog std MFC app linking to bog std MFC
extension dll - both generated by the wizards. The code is set out below.
The trouble is with the static member variable of CTest.
Can anyone help?
Thanks
Sam
// test.hpp
// CTest
class AFX_CLASS_EXPORT CTest : public CWnd
{
DECLARE_DYNAMIC(CTest)
public:
CTest();
virtual ~CTest();
protected:
DECLARE_MESSAGE_MAP()
public:
TCHAR * m_test00;
static TCHAR * m_static00;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!
};
// end of test.hpp
// test mfc extension dll code
// Test.cpp : implementation file
//
#include "stdafx.h"
#include "Test.hpp"
// CTest
IMPLEMENT_DYNAMIC(CTest, CWnd)
CTest::CTest()
: m_test00(_T("m_test00 OK"))
{
}
CTest::~CTest()
{
}
TCHAR * CTest::m_static00(_T("m_static00 OK"));
BEGIN_MESSAGE_MAP(CTest, CWnd)
END_MESSAGE_MAP()
// end Test.cpp
// test mfc app code
#include "test.hpp"
CTest test;
MessageBox(0, CTest::m_static00, test.m_test00, MB_OK);
// end of test mfc extension code
Error message:
Basic_MFC_app.obj : error LNK2001: unresolved external symbol "public:
static wchar_t * CTest::m_static00" (?m_static00@CTest@@2PA_WA)