A
Allen
I write 3 classes:
class CRPCParaPacker
{
private:
CRPCInParaPacker inPack;
CRPCOutParaPacker outPack;
};
I want to export only CRPCParaPacker class. So in the header file of
CRPCParaPacker, I use
#ifdef WIN32
#ifdef RPCPACKER_EXPORTS
#define RPCPACKER_API __declspec(dllexport)
#else
#define RPCPACKER_API __declspec(dllimport)
#endif
#ifndef RPCPACKER_EXPORTS
#pragma comment(lib, "RPCPacker.lib")
#pragma message("Automatically linking with RPCPacker.dll")
#endif
#pragma warning(disable : 4251)
#endif
class CRPCInParaPacker;
class CRPCOutParaPacker;
class RPCPACKER_EXPORTS CRPCParaPacker
{
private:
CRPCInParaPacker inPack;
CRPCOutParaPacker outPack;
};
Class CRPCInParaPacker and CRPCOutParaPacker are not exported.
When compile above classes into DLL, it is ok.
But when used in other application, it is compiled with errors:
rpcparapacker.h(190) : error C2079: "CRPCParaPacker::inPacker" uses
undefined class"CRPCInParaPacker"
rpcparapacker.h(190) : error C2079: "CRPCParaPacker:utPacker" uses
undefined class"CRPCOutParaPacker"
Why?
class CRPCParaPacker
{
private:
CRPCInParaPacker inPack;
CRPCOutParaPacker outPack;
};
I want to export only CRPCParaPacker class. So in the header file of
CRPCParaPacker, I use
#ifdef WIN32
#ifdef RPCPACKER_EXPORTS
#define RPCPACKER_API __declspec(dllexport)
#else
#define RPCPACKER_API __declspec(dllimport)
#endif
#ifndef RPCPACKER_EXPORTS
#pragma comment(lib, "RPCPacker.lib")
#pragma message("Automatically linking with RPCPacker.dll")
#endif
#pragma warning(disable : 4251)
#endif
class CRPCInParaPacker;
class CRPCOutParaPacker;
class RPCPACKER_EXPORTS CRPCParaPacker
{
private:
CRPCInParaPacker inPack;
CRPCOutParaPacker outPack;
};
Class CRPCInParaPacker and CRPCOutParaPacker are not exported.
When compile above classes into DLL, it is ok.
But when used in other application, it is compiled with errors:
rpcparapacker.h(190) : error C2079: "CRPCParaPacker::inPacker" uses
undefined class"CRPCInParaPacker"
rpcparapacker.h(190) : error C2079: "CRPCParaPacker:utPacker" uses
undefined class"CRPCOutParaPacker"
Why?