warning C4251: 'm_ListInfo' : struct 'DuiLib::tagTListInfoUI' needs to have dll-interface to be used
2012-05-10 16:26
344 查看
在StdAfx.h中添加以下:
// Duilib使用设置部分
#pragma once
#define WIN32_LEAN_AND_MEAN
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <objbase.h>
#include "..\DuiLib\UIlib.h"
using namespace DuiLib;
#ifdef _DEBUG
# ifdef _UNICODE
# pragma comment(lib, "..\\bin\\DuiLib_ud.lib")
# else
# pragma comment(lib, "..\\bin\\DuiLib_d.lib")
# endif
#else
# ifdef _UNICODE
# pragma comment(lib, "..\\bin\\DuiLib_u.lib")
# else
# pragma comment(lib, "..\\bin\\DuiLib.lib")
# endif
#endif
之后编译一下就会出警告warning C4251: 'm_ListInfo' : struct 'DuiLib::tagTListInfoUI' needs to have dll-interface to be used by clients of class 'DuiLib::CListUI'等。。��?/P>
大概意思是说:结构体tagTListInfoUI被CListUI类使用需要一个dll接口(因为CListUI'被__declspec(dllexport/dllimport))所以也要把结构体也需要__declspec(dllexport/dllimport)),就是在结构体加上导入导出宏UILIB_API。typedef struct UILIB_API tagTListInfoUI{...}
#ifdef UILIB_EXPORTS
#define UILIB_API __declspec(dllexport)
#else
#define UILIB_API __declspec(dllimport)
#endif
// Duilib使用设置部分
#pragma once
#define WIN32_LEAN_AND_MEAN
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <objbase.h>
#include "..\DuiLib\UIlib.h"
using namespace DuiLib;
#ifdef _DEBUG
# ifdef _UNICODE
# pragma comment(lib, "..\\bin\\DuiLib_ud.lib")
# else
# pragma comment(lib, "..\\bin\\DuiLib_d.lib")
# endif
#else
# ifdef _UNICODE
# pragma comment(lib, "..\\bin\\DuiLib_u.lib")
# else
# pragma comment(lib, "..\\bin\\DuiLib.lib")
# endif
#endif
之后编译一下就会出警告warning C4251: 'm_ListInfo' : struct 'DuiLib::tagTListInfoUI' needs to have dll-interface to be used by clients of class 'DuiLib::CListUI'等。。��?/P>
大概意思是说:结构体tagTListInfoUI被CListUI类使用需要一个dll接口(因为CListUI'被__declspec(dllexport/dllimport))所以也要把结构体也需要__declspec(dllexport/dllimport)),就是在结构体加上导入导出宏UILIB_API。typedef struct UILIB_API tagTListInfoUI{...}
#ifdef UILIB_EXPORTS
#define UILIB_API __declspec(dllexport)
#else
#define UILIB_API __declspec(dllimport)
#endif
相关文章推荐
- 去除Warning C4251 “class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class
- warning C4251: 'vectortemp::m_Vector' : class 'std::vector' needs to have dll-interface to be used by clients of class 'vectorte
- warning C4251 needs to have dll-interface解决办法
- 如何解决VC中的警告warning C4251 needs to have dll-interface
- warning C4251 needs to have dll-interface解决办法
- warning C4251 needs to have dll-interface解决办法
- VS2005 warning C4251 needs to have dll-interface
- 如何解决VC中的警告warning C4251 needs to have dll-interface
- monogame Unable to load DLL 'openal32.dll': The specified module could not be found
- error C2894: templates cannot be declared to have 'C' linkage
- error C2011: '_INTERFACE_INFO' : 'struct' type redefinition
- 安卓开发——报错:Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null
- Must use 'struct' tag to refer to type 'tagCommonUserInfo'
- [Hibernate]Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- MAC安装chromedriver提示“Message: 'chromedriver' executable needs to be in PATH.Please see ...”
- [Hibernate]Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- 创建SessionFactory出错Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation'
- error C2894: templates cannot be declared to have 'C' linkage
- Swift中推送通知设置:Binary operator '|' cannot be applied to two UIUserNotificationType operands 错误解决