网络字节顺序到主机顺序链接器问题 [英] Network byte order to host order linker problem

查看:66
本文介绍了网络字节顺序到主机顺序链接器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试从网络字节顺序转换为主机字节顺序,以下是完成此操作的方式.

u_short sport,dport;

Hi guts,

I am trying to convert from network byte order to host byte order and below is the way have done it.

u_short sport,dport;

sport = ntohs(uh->sport);
    dport = ntohs(uh->dport)


;

但是我在构建链接时遇到了此链接错误.


;

but i got this link error when i built it.

1>WinPcap_Test.obj : error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function _main
1>dir\Debug\WinPcap_Test.exe : fatal error LNK1120: 1 unresolved external




任何人都可以帮助解决这个问题.

非常感谢.




could anyone help to resolve this problem please.

Many thanks.

推荐答案

Ws2_32.lib 添加到链接器模块.


这篇关于网络字节顺序到主机顺序链接器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆