a problem about how to use a class in dll
-
Hi: In my programme,I use some classes in a dll.When I try to compile it, VC give out such errors: error C2487: 'classCWinAppEx' : member of dll interface class may not be declared with dll interface error C2487: 'classCMyMenu' : member of dll interface class may not be declared with dll interface (CWinAppEx and CMyMenu are declare and implemented in the dll) and all these errors are point to the line "DECLARE_DYNAMIC( CWinAppEx )" or "DECLARE_DYNAMIC( CMyMenu )". I look up this error in MSDN, but didn't find the solution.Could anyone give me some idea? Thanks Benben
-
Hi: In my programme,I use some classes in a dll.When I try to compile it, VC give out such errors: error C2487: 'classCWinAppEx' : member of dll interface class may not be declared with dll interface error C2487: 'classCMyMenu' : member of dll interface class may not be declared with dll interface (CWinAppEx and CMyMenu are declare and implemented in the dll) and all these errors are point to the line "DECLARE_DYNAMIC( CWinAppEx )" or "DECLARE_DYNAMIC( CMyMenu )". I look up this error in MSDN, but didn't find the solution.Could anyone give me some idea? Thanks Benben
-
try to use __declspec(dllexport) while declare class Exa: #define EXT_CLASS __declspec(dllexport) class EXT_CLASS ClassA : public X { ... };
-
Thanks.I have used this macro in the dll. And thses errors only occour when I try to compile one certain file(when I compile the other files, VC doesn't give out these errors). Thanks Benben
and I find that these errors only occur when the cpp files in EXE project have such line: #undef AFX_DATA #define AFX_DATA AFX_DATA_EXPORT Maybe it conflict with the static functions or something else in the dll.How to resolve this problem? Could anyone give some idea? Thanks Benben