SOCKUTIL.H上出现错误信息C2373 [英] Error Message C2373 On SOCKUTIL.H

查看:95
本文介绍了SOCKUTIL.H上出现错误信息C2373的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在收到此错误消息.......
错误1错误C2373:htons:重新定义;不同类型的修饰符



I''m getting this error mesage.......
Error 1 error C2373: htons : redefinition; different type modifiers



<>;#if !defined(SOCKUTIL_H)
#define SOCKUTIL_H
int inet_addr(const char *sIp, unsigned long *lIp);
unsigned short htons(unsigned short port);
char *IpToString(char *ip, unsigned long lIp);
#endif

推荐答案

您可能在代码中执行了#include Winsock2.h,并获得了库定义u_short WSAAPI htons(u_short hostshort).您的定义不相同(WSAAPI),因此您正在执行重新定义".

确定使用哪种方式,您的SOCKUTIL或Winsock2取决于您,您不能两者都使用.
You probably did an #include Winsock2.h in your code and got the library definition u_short WSAAPI htons(u_short hostshort). Your definition is not the same (WSAAPI) hence you are doing a "redefinition".

Deciding which to use, your SOCKUTIL or Winsock2 is up to you, you just can''t use both.


这篇关于SOCKUTIL.H上出现错误信息C2373的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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