snmp++的使用一

如果你在使用snmp++出现如下同样错误:这里住下看可以解决!

--------------------Configuration: tt - Win32 Debug--------------------
Linking...
tt.obj : error LNK2001: unresolved external symbol "public: class IpAddress & __thiscall IpAddress::operator=(char const *)" (??4IpAddress@@QAEAAV0@PBD@Z)
tt.obj : error LNK2001: unresolved external symbol "public: void __thiscall UdpAddress::set_port(unsigned short)" (?set_port@UdpAddress@@QAEXG@Z)
tt.obj : error LNK2001: unresolved external symbol "public: class UdpAddress & __thiscall UdpAddress::operator=(char const *)" (??4UdpAddress@@QAEAAV0@PBD@Z)
tt.obj : error LNK2001: unresolved external symbol "public: unsigned short __thiscall UdpAddress::get_port(void)const " (?get_port@UdpAddress@@QBEGXZ)
tt.obj : error LNK2001: unresolved external symbol "public: __thiscall UdpAddress::UdpAddress(char const *)" (??0UdpAddress@@QAE@PBD@Z)
tt.obj : error LNK2001: unresolved external symbol "public: __thiscall IpAddress::IpAddress(char const *)" (??0IpAddress@@QAE@PBD@Z)
tt.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall IpAddress::set_scope(unsigned int)" (?set_scope@IpAddress@@UAE_NI@Z)
tt.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall IpAddress::get_scope(void)const " (?get_scope@IpAddress@@UBEIXZ)
tt.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IpAddress::map_to_ipv6(void)" (?map_to_ipv6@IpAddress@@UAEHXZ)
tt.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall IpAddress::format_output(void)const " (?format_output@IpAddress@@MBEXXZ)
tt.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall IpAddress::parse_address(char const *)" (?parse_address@IpAddress@@MAE_NPBD@Z)
tt.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IpAddress::clear(void)" (?clear@IpAddress@@UAEXXZ)
tt.obj : error LNK2001: unresolved external symbol "public: virtual class SnmpSyntax & __thiscall IpAddress::operator=(class SnmpSyntax const &)" (??4IpAddress@@UAEAAVSnmpSyntax@@ABV1@@Z)
tt.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Address::clear(void)" (?clear@Address@@MAEXXZ)
tt.obj : error LNK2001: unresolved external symbol "public: __thiscall IpAddress::IpAddress(class IpAddress const &)" (??0IpAddress@@QAE@ABV0@@Z)
tt.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall UdpAddress::set_scope(unsigned int)" (?set_scope@UdpAddress@@UAE_NI@Z)
tt.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall UdpAddress::map_to_ipv6(void)" (?map_to_ipv6@UdpAddress@@UAEHXZ)
tt.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall UdpAddress::format_output(void)const " (?format_output@UdpAddress@@MBEXXZ)
tt.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall UdpAddress::parse_address(char const *)" (?parse_address@UdpAddress@@MAE_NPBD@Z)
tt.obj : error LNK2001: unresolved external symbol "public: virtual class SnmpSyntax & __thiscall UdpAddress::operator=(class SnmpSyntax const &)" (??4UdpAddress@@UAEAAVSnmpSyntax@@ABV1@@Z)
tt.obj : error LNK2001: unresolved external symbol "public: __thiscall UdpAddress::UdpAddress(class UdpAddress const &)" (??0UdpAddress@@QAE@ABV0@@Z)
Debug/tt.exe : fatal error LNK1120: 21 unresolved externals
执行 link.exe 时出错.

tt.exe - 1 error(s), 0 warning(s)

参考这篇文档,SNMP++在VC6下的编辑和使用(三) 该文给出解决编译时出现问题解的办法即把snmp_pp.lib  WS2_32.LIB加入到对象/库模块中(工程/设置/连接/常规)但给出的程序不完整,

#include "snmp_pp.h"
#include "iostream.h"

void main()
{
 IpAddress ip("127.0.0.1");
 cout<<"ip address is:"<<ip<<endl;
 UdpAddress udp("127.0.0.1:8888");
 cout<<"udp address is:"<<udp<<endl;
 cout<<"udp address port is:"<<udp.get_port()<<endl;
 udp="127.0.0.1";
 udp.set_port(9999);
 cout<<udp<<endl;
 ip="258.0.0.1";
  if(!ip.valid())
   cout<<"bad ip:258.0.0.1"<<endl;
  else
   cout<<"good ip:258.0.0.1"<<endl;
  ip="255.0.0.1";
 if(!ip.valid())
  cout<<"error ip:255.0.0.1"<<endl;
 else
  cout<<"good ip:255.0.0.1"<<endl;
 ip="0.0.0.0";
 if(!ip.valid())
  cout<<"error ip:0.0.0.0"<<endl;
 else
  cout<<"good ip:0.0.0.0"<<endl;
 ip="255.255.255.255";
  if(!ip.valid())
   cout<<"error ip:255.255.255.255"<<endl;
  else
   cout<<"good ip:255.255.255.255"<<endl;
}

至此你的问题已经解决。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值