积极答复者
VS2005调用inet_pton()函数(IPv6地址转换函数)

问题
-
Windows 7,VS2005
想把IPv6地址字符串转换为struct in6_addr类型的结构体,
也就是类似Linux下的和inet_ntop函数。
查了MSDN,有个inet_pton函数InetPton和InetNtop:
http://msdn.microsoft.com/en-us/library/windows/desktop/cc805844(v=vs.85).aspx导入了Ws2_32.lib,又从VS2010的<Ws2tcpip.h>中拷贝了inet_ntop()的声明,如下:
-
#pragma comment(lib,"Ws2_32.lib")WINSOCK_API_LINKAGE
INT
WSAAPI
inet_pton(
__in INT Family,
__in PCSTR pszAddrString,
__out_bcount(sizeof(IN6_ADDR)) PVOID pAddrBuf
);
但是链接时还是提示:
错误1 error LNK2019: 无法解析的外部符号
"__declspec(dllimport) int __stdcall inet_pton(int,char const *,void *)" (__imp_?inet_pton@@YGHHPBDPAX@Z),
该符号在函数 _main 中被引用 NDPSpoof.obj
这要怎么解决呢?
- 已编辑 Memorycn 2012年4月14日 7:45
-
答案
-
用2008以上的IDE
新浪微博http://weibo.com/xianglitian,欢迎围观
- 已建议为答案 Helen Zhao 2012年4月16日 4:40
- 已标记为答案 Helen Zhao 2012年4月23日 1:35
全部回复
-
Requirements Minimum supported client :Windows Vista Minimum supported server :Windows Server 2008 Header :Ws2tcpip.h Library :Ws2_32.lib DLL :Ws2_32.dll Unicode and ANSI names InetPtonW (Unicode) and InetPtonA or inet_pton (ANSI)
您的平台是Vista之后的吗?Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
-
Requirements Minimum supported client :Windows Vista Minimum supported server :Windows Server 2008 Header :Ws2tcpip.h Library :Ws2_32.lib DLL :Ws2_32.dll Unicode and ANSI names InetPtonW (Unicode) and InetPtonA or inet_pton (ANSI)
您的平台是Vista之后的吗?
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
是啊,Windows 7 -
用2008以上的IDE
新浪微博http://weibo.com/xianglitian,欢迎围观
- 已建议为答案 Helen Zhao 2012年4月16日 4:40
- 已标记为答案 Helen Zhao 2012年4月23日 1:35