Cannot see any problem:
1. enshure the output path for DLL and LIB file is the path you load the DLL and include the LIB in your project (usually the same as the EXE output path).
2. include the header and the LIB with correct filename (perhaps including path).
3. first project for DLL and LIB contains:
exportable.h and
exportable.cpp
4. the exe file is one
DerivedClass.cpp
example:
LIB and DLL project
content exportable.h
#ifdef BASECLASSDLL_EXPORTS
#define DLLDLL_API __declspec(dllexport)
#else
#define DLLDLL_API __declspec(dllimport)
#endif
class DLLDLL_API CBase
{
private:
int identifier;
protected:
CBase (int ID);
virtual ~CBase (){}
TCHAR szText [40];
};
class DLLDLL_API CDerivedA : virtual public CBase
{
public:
CDerivedA (int ID);
~CDerivedA (){};
void SetTextA (TCHAR* sz);
void ShoutA (HWND hwnd);
};
class DLLDLL_API CDerivedB : virtual public CBase
{
public:
CDerivedB (int ID);
~CDerivedB (){};
void SetTextB (TCHAR* sz);
void ShoutB (HWND hwnd);
};
class DLLDLL_API CDerivedAB : public CDerivedA, public CDerivedB
{
public:
CDerivedAB (int ID);
~CDerivedAB (){}
void SetTextAB (TCHAR* sz);
void ShoutAB (HWND hwnd);
};
content of exportable.cpp
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
int FAR PASCAL DllMain(HMODULE h,DWORD r,void*){ return 1; }
#include <tchar.h>
#include "exportable.h"
CBase::CBase(int ID)
{
identifier = ID;
szText[0] = 0;
}
CDerivedA::CDerivedA(int ID)
:CBase (ID)
{
}
void CDerivedA::SetTextA (TCHAR* sz)
{
_tcscpy_s(szText,sizeof(szText)/sizeof(szText[0]),sz?sz:__T(""));
}
void CDerivedA::ShoutA (HWND hwnd)
{
MessageBox (hwnd, szText, TEXT ("CDerivedA:"), MB_OK);
}
CDerivedB::CDerivedB(int ID)
:CBase (ID)
{
}
void CDerivedB::SetTextB (TCHAR* sz)
{
_tcscpy_s(szText,sizeof(szText)/sizeof(szText[0]),sz?sz:__T(""));
}
void CDerivedB::ShoutB (HWND hwnd)
{
MessageBox (hwnd, szText, TEXT ("DerivedB:"), MB_OK);
}
CDerivedAB::CDerivedAB (int ID)
:CBase(ID),CDerivedA(ID),CDerivedB(ID)
{
}
void CDerivedAB::SetTextAB (TCHAR* sz)
{
SetTextA(sz);
SetTextB(sz);
}
void CDerivedAB::ShoutAB (HWND hwnd)
{
MessageBox (hwnd, szText, TEXT ("CDerivedAB:"), MB_OK);
}
the EXE file that import all these things. Output path is
.\run.
content of DerivedClass.cpp
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include "<replace this with your path>\DerivedClass\BaseClassDLL\exportable.h"
#pragma comment (lib,"<replace this with your path>\\DerivedClass\\run\\BaseClassDLL.lib")
int FAR PASCAL _tWinMain(HINSTANCE h,HINSTANCE p,LPTSTR c,int sw)
{
CDerivedAB ab(1);
ab.SetTextAB(__TEXT("Hello world"));
ab.ShoutAB(0);
return 0;
}
Regards.
[edit] some useless fragments removed.