error C2491: 'XXX'::entries' : definition of dllimport function not allowed
-
Hi, dear all, I have a DLL file created in C++ 6.0, now move to VS2008 and get compile error. in header file: #define XXXPORT __declspec(dllimport) template <class TP> class XXXPORT TPtrList { public: int entries(bool deleted = false) const; TP *operator[](int n); const TP *operator[](int n) const; .............. .............. } in .cpp file template <class TP> inline int TPtrList<TP>::entries(bool deleted) const { ......... } template <class TP> inline TP *ABSTPtrList::operator[](int n) { .........} In C++, they are fine, but in VS2008, When I compile it, I got error C2491: 'TPtrList<TP>'::entries' : definition of dllimport function not allowed error C2491: 'TPtrList<TP>::operator []' : definition of dllimport function not allowed What cause this problem? Thanks!
-
Hi, dear all, I have a DLL file created in C++ 6.0, now move to VS2008 and get compile error. in header file: #define XXXPORT __declspec(dllimport) template <class TP> class XXXPORT TPtrList { public: int entries(bool deleted = false) const; TP *operator[](int n); const TP *operator[](int n) const; .............. .............. } in .cpp file template <class TP> inline int TPtrList<TP>::entries(bool deleted) const { ......... } template <class TP> inline TP *ABSTPtrList::operator[](int n) { .........} In C++, they are fine, but in VS2008, When I compile it, I got error C2491: 'TPtrList<TP>'::entries' : definition of dllimport function not allowed error C2491: 'TPtrList<TP>::operator []' : definition of dllimport function not allowed What cause this problem? Thanks!
This looks like you're defining the functions when doing the dll import... when all you should have is function prototypes. You probably want to define XXPORT up there to say dllexport.
-
This looks like you're defining the functions when doing the dll import... when all you should have is function prototypes. You probably want to define XXPORT up there to say dllexport.