我的DLL里有几个界面的类如:CxxButton,它继承自CButton,但静态连接编译的时候会得到警告:warning C4275: non dll-interface class 'CButton' used as base for dll-interface class 'CxxButton'
静态连接(测试程序和DLL都使用Use MFC in a static library)时能成功编译,但在测试程序里我输出的类CxxButton没有作用,没能重画Button(在测试程序里的头文件里我申明了button为CxxButton的实例的),放在对话框上的Button控件仍然是它的本来面目。
在使用动态连接(测试程序和DLL都使用Use MFC in a Share DLL)时既能成功编译,也不提示有警告错误,还能正确的显示(能重画button).大家帮帮忙,弄了很久都不能解决。弄得郁闷了。

解决方案 »

  1.   

    继承的类没有定义输出:参考帖子:http://search.csdn.net/Expert/topic/207/207377.xml?temp=.5513269
    http://search.csdn.net/Expert/topic/1294/1294550.xml?temp=.4942133
      

  2.   

    谢谢楼上的朋友的回复。
    如果是没找到头文件,那么在使用Use MFC in a Share DLL时也应该不能行的啊!
      

  3.   

    我是这样声明的:
    #ifdef XXLIB_IMPL
        #define XXLIB_EXT_CLASS _declspec( dllexport )
        #define XXLIB_EXT_API _declspec( dllexport )
    #else
        #define XXLIB_EXT_CLASS _declspec( dllimport )
        #define XXLIB_EXT_API _declspec( dllimport )
    #endifclass XXLIB_EXT_CLASS CxxButton : public CButton
    为是什么还是不行呢?