warning C4273 And LNK4049:

来源:互联网 发布:淘宝推广工具排名 编辑:程序博客网 时间:2024/05/01 18:03
//DownNet.h

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifdef DOWNNET_DLL
#pragma  message (" export DownNet ")
#define DownAPI __declspec(dllexport)
#else
#pragma  message (" import DownNet ")
#define DownAPI __declspec(dllimport)
#endif
#pragma comment(lib,"DownNet .lib")

BOOL DownAPI DownloadFile(    HWND    hWnd,              // 下载对话框的句柄,用于发送消息
                               int        nDownMode,         // 下载模式:1为比对下载 2为快速修复 3为修复游戏
                               LPTSTR  lpszGameSort,    // 所点击游戏的游戏分类
                               LPTSTR  lpszClickName    // 点击游戏名
                               );
BOOL DownAPI DownloadFile(    HWND    hWnd,              // 下载对话框的句柄,用于发送消息
                           int        nDownMode,         // 下载模式:1为比对下载 2为快速修复 3为修复游戏
                           LPTSTR  lpszFullGameName    // 所点击的游戏(游戏分类+名称)
                          );



// DownCoreApp.h

#ifdef DOWNNET_DLL
#pragma  message (" export DownNet  dll. udknight")
#define DOWNNETSDK_API   __declspec(dllexport)
#else
#pragma  message (" import DownNet dll. udknight")
#define DOWNNETSDK_API   __declspec(dllimport)
#endif
class CTimerThread;
class DOWNNETSDK_API DownCoreApp
{
   .............

}


: warning C4273: 'GetGameVersion' : inconsistent dll linkage. dllexport assumed.: warning C4273: 'GetGameDownloadPath' : inconsistent dll linkage. dllexport assumed.

 

reason:

 

warning C4273 means that you've probably "double declared" these (as the same type, but with different linkages). The compiler is assuming you meant to export them.

 

DLL 导出函数中有重载函数,我的工程中没有必要,所以将其中一个DownloadFile删除即可消除,但是还有 warning LNK4049:

 

另外一个主要的是类DownCoreApp定义已经将成员函数导出,两处文件导出,所以导致了warning LNK4049:

 

如果不想让人用这个类,让调用者直接调函数的话,将DownCoreApp定义前的DOWNNETSDK_API直接删除即可消除警告


0 0
原创粉丝点击