Click here to Skip to main content
15,918,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
meomeo123456 10-Oct-12 3:22am    
Can you fix it ?

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900