我有一个名为 NetworkInterfaceInfoProvider.h 的头文件。在这个头文件中我声明一个类如下:
#ifndef INETWORK_INTERFACE_INFO_PROVIDER_H
#define INETWORK_INTERFACE_INFO_PROVIDER_H
#pragma once
/*#include "stdafx.h"*/
#include "IConfig.h"
#include "NetworkAddapterAddresses.h"
#include "InstaledAddapters.h"
namespace IRNetwork
{
class CLASS_DECLSPEC INet;
struct CLASS_DECLSPEC GenericIPAddress;
/*
* provide information about all network interface related adapters such as installed interfaces , addresses , best routes and ...
* TO DO: implement Other OS's
*/
class CLASS_DECLSPEC INetworkInterfaceInfoProvider
{
public:
INetworkInterfaceInfoProvider(void);
~INetworkInterfaceInfoProvider(void);
int32_t GetBestRouteTo(char* destIp,uint16_t port,ip_t *ip);
int32_t GetBestRouteTo(GenericIPAddress* ip);
private:
INet* snet;
};
}
#endif
当我想在我的控制台应用程序中使用它时,出现以下链接器错误
*注意:以上代码库已链接到我的控制台应用程序。CLASS_DECLSPEC 是 dll 导入/导出定义*
错误 LNK2019:未解析的外部符号“__declspec(dllimport) public: int __thiscall IRNetwork::INetworkInterfaceInfoProvider::GetBestRouteTo(char ,unsigned short,char ( )[65])” (_ imp ?GetBestRouteTo@INetworkInterfaceInfoProvider@IRNetwork@@QAEHPADGPAY0EB@D @Z) 在函数“void __cdecl test_adapters(void)”(?test_adapters@@YAXXZ) testDhcpv4.obj testDhcpv4 中引用
这里有什么问题?