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.objtestDhcpv4で参照
ここで何が問題になっていますか?